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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
srhsloan
Frequent Visitor

Make Card Visual show 0 not Blank

I've got a card visual which is just showing a count of how many items match my filter. It works great when there are items matching, but if nothing matches it shows (Blank). How can I make it show 0 instead please?

 

image.png

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @srhsloan,

 

Power BI measures behave like that by design. You need to set it in your measure If you want to override this behavior. You can make your DAX measure something like this:

 

 

MEASURE =
IF ( ISBLANK ( SUM ( 'Table'[Sales] ) ), 0, SUM ( 'Table'[Sales] ) )

 

Be aware that the this will affect how the visuals that use this modified measure and other measures that are dependent on this modified measure look.

 

 






Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu.

View solution in original post

5 REPLIES 5
PaulDBrown
Community Champion
Community Champion

@srhsloan

 

Alternatively, you can add '+ 0' at the end of the measure calculation (displayed in the card).

 

Regards,

 

Paul.





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






danextian
Super User
Super User

Hi @srhsloan,

 

Power BI measures behave like that by design. You need to set it in your measure If you want to override this behavior. You can make your DAX measure something like this:

 

 

MEASURE =
IF ( ISBLANK ( SUM ( 'Table'[Sales] ) ), 0, SUM ( 'Table'[Sales] ) )

 

Be aware that the this will affect how the visuals that use this modified measure and other measures that are dependent on this modified measure look.

 

 






Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu.

You can also use the following if the dataType of the column you are working with is "string":

hope this helps anyone.

 

MEASURE =
IF ( ISBLANK ( COUNTA('Table'[Sales] ) ), 0, COUNTA('Table'[Sales] ) )

Thanks @danextian. I wasn't using a measure, just the filter fields, but a measure has sorted out exactly what I needed. The final formula I've ended up with is 

NoTShirtSize = IF(ISBLANK(COUNTBLANK('Work Items - Today'[TShirt Size])), 0, COUNTBLANK('Work Items - Today'[TShirt Size]))

Hi

I am very New to power bi can tell me Where i have to put this syntax/formula in detail?

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.