Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
ovonel
Post Prodigy
Post Prodigy

Make a measure display 0 instead of blank in 'card' visualization

I have my measure Revenue YearToDate as

 

CALCULATE( [Revenue] , DATESYTD('Date'[Date],"31/05" ))


For dates with no revenue... If I choose a 'card' visualization I get the value (blank) instead of 0, why is that? how can I change it to display 0 instead of 'blank'?

3 REPLIES 3
ovonel
Post Prodigy
Post Prodigy

Thanks, I was wondering... this link Power BI: What is DAX? And Why you Should (or Should Not) Learn It | by ZhongTr0n | Towards Data Sci...

 

Says: "When displaying numerical data in a card, for example ‘revenue’, it will return ‘blank’ if you set your filters in a way there is no revenue to show. However, a more natural way to display ‘no revenue’ should be ‘0’ instead of ‘blank’. With a very simple DAX expression, you can yourself create a measure adding a ‘0’ to the formula, meaning you will never have to see ‘blank’ again.

 

Why the link says its very simple? it doesnt look like that...

Anonymous
Not applicable

I guess it's subjective, what one person considers simple might not be the same for another. Only the author could really answer your question. 

Anonymous
Not applicable

add +0 to the end of your measure 

 

 

CALCULATE( [Revenue] , DATESYTD('Date'[Date],"31/05" ))+0

 

 

You could also tie it into an IF statement, for example 

 

= 
VAR _RevenueYearToDate = CALCULATE( [Revenue] , DATESYTD('Date'[Date],"31/05" ))

Return 

IF(_RevenueYearToDate= "null" , 0 ,_RevenueYearToDate)

 


To answer your question, it's resulting in "null" or "blank" because that is the answer. If it has nothing to calculate (because the values are blank) the answer is Blank. If it were calculating 1-1 then the answer would be 0 but "blank" - "blank" = "blank" i.e. no values can be found, therefore the result is blank. 


Remember in binary "0" is a value in its own right. So if your "Revenue" column is "null" and not "0" it's treated as a null value, which is different to 0. 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.

Top Solution Authors