Posts

Showing posts from April, 2020

Donate

Power BI : Count Rows Using RowCount Not Working

I have this DAX formula that counts the number of rows using Calculate() function with [RowCount] as the expression and a certain condition as the filter. CountARCurrent = CALCULATE([RowCount], AccountsReceivablesAging[ Current ] > 0 ) This works on most of the report's dataset however when I tried importing a new dataset, the formula above didn't work. The data used in the filter is a floating point number and the datasets involved in this project are imported via Direct Query. After searching the Power BI forums, I found an alternative solution which is to use COUNTROWS() function instead of [RowCount] as the expression. CountARCurrent = CALCULATE(COUNTROWS(AccountsReceivablesAging), AccountsReceivablesAging[ Current ] > 0 )

Rounding Off Floating Point Numbers To Integer Using DAX In Power BI

Hi, Just sharing a simple DAX formula to round off floating point numbers to int. AvgDayToPayRnd = Int (ROUND(AccountsReceivablesAging[AvgDayToPay], 0 )) First, you have to use the Round() function passing in the table column as the first parameter and 0 which means no trailing zeroes in the second parameter. Then cast that number to an integer type using the Int() function. Cheers!

How To Check If SQL Server Column Is Null Or Empty

Hello fellow programmers! Here's a simple T-SQL statement that will check if a column value is null or empty. IIF( c .BillPhone is null , '' , IIF(Len( c .BillPhone) > 0, c .BillPhone , '' )) as BillingPhone First, it will check if the field is null. If true, it will return empty string. Else, another checking will be performed and this time if it's an empty string. If not an empty string, show the column value. Else show an empty string. That's it! :-)

Donate