Just a little background on the above table:
Project Name, Category Name, and Portfolio Name are from a table called 'Projects"
Actual, Committed are from a table called 'Expenses'
Projects is a one to many relationship with Expenses
In the above scenario, the project "cancer test project 5" has no related records in the Expenses table, so it is showing as blank, is there a way to show 0 instead
I have tried doing the following in the Projects table, but it gave unexpected results: Actual = IF(ISBLANK(SUMX(RELATEDTABLE('Expenses'), [Actual])) = FALSE(), SUMX(RELATEDTABLE('Expenses'), [Actual]), 0)
Solved! Go to Solution.
Hi, please try with this Dax Formula in a measure:
ActualM = IF ( CALCULATE ( SUM ( Expenses[Actual] ) ) = BLANK (), 0, CALCULATE ( SUM ( Expenses[Actual] ) ) )
Even easier would be to add zero to your Measure
Then you don't need an IF statement to check if the expression returns BLANK ( )
So if your SUMX Measure works get rid of the IF statement and just add " + 0 "at the end
same with if you use any other expression (something like this for example)
Measure = CALCULATE ( SUM (table[column] ), FILTER (... ) ) + 0
This will ensure you get a 0 when its blank!
UPDATE: March 2020
New DAX COALESCE function - returns the first argument that is not blank!
If all arguments return blank then COALESCE returns blank as well!
So if you need a zero returned and not blank and your Measures don't address the blanks on their own
Add a zero as the last argument in case all Measures return blanks!
COALESCE ( [Measure1], [Measure2], 0 )
I used the '+0' to show ) instead of blanks and it was working well. But, today I used the same thing and it now showing blank instead of 0, is there an update or a configuration in the table that I need to change? Thank you!
I have a different issue when I added the +0 at the end of my measure it still does not display 0s for Blank.
Please refer the below syntax
VAR MaxDate = MAX ( 'Acctng_Period'[Date] )
if( ISBLANK( CALCULATE (
ALL ( 'Acctng_Period')
)) , 0 , CALCULATE (
ALL ( 'Acctng_Period') )) + 0
@Aks-1 it looks like you can solve this by simplifying your DAX syntax by removing the IF statement. The way your current syntax reads is: SUM these values, if the result IS BLANK then return a 0, otherwise SUM the values. In DAX, you can't really do a SUM and check it for a TRUE/FALSE unless you're using it as a VAR. To appropriate the DAX syntax, I recommend seeing if the below formula will return your desired results:
VAR MaxDate = MAX ( 'Acctng_Period'[Date] ) RETURN
SUM(LossTriangle_POC[WINS_Medical_Paid]), 'Acctng_Period'[Date]<= MaxDate, ALL ( 'Acctng_Period')
) + 0
There isn't a difference between your TRUE & FALSE clause calcuations, so I believe this updated syntax will correctly return the results you are looking for.
Kinldy assist, im still getting a blank on mine:(
Here's the formula:
@Anonymous It looks like this is a calcuate column? And then you would like to sum-up the column? If this is the case try: IF(MONTH('Coal Lab'[Start Date]) =MONTH('Coal Lab'[End Date]),1 ,0).
The trick with the +0 applies to creating measures, if you'd prefer to use that method it would look more like:
NoOfBreakdownsSameMonth = CALCULATE(COUNTX('Coal Lab',[<field to count>]),MONTH('Coal Lab'[Start Date]) =MONTH('Coal Lab'[End Date)) + 0
Let me know if this helps and/or works.
Heyy, this works! Thanks!
For me it needs some final tweaking. I'm using a measure with a start and end date and I dont want it to show zeros before the start and after the zero, because I have 3 measures that follow up each other. See screenshot.
Hi, When i do this to my measure it does add a 0 to the measure, however when i have my matrix it expands the rows so it repeats 0's for rows that it shouldn't show. I assume i need to relate it somehow?
@orangeatom What is your dax function? And have you a screenshot of the resulting matrix?
Seems something like if the row total = 0 then return blank() for the row values, instead of zeros.
I found the solution by approaching the problem in a different view. What worked for my is to correctly keep blanks at the lowest grain of my measure which I now realize was a similar yet different problem. My solution was to create a measure with a variable and a return that correctly keeps the 0's.
Take a look at the September 2023 Power BI update to learn more.
Join Microsoft Reactor and learn from developers.
Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!
Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.