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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
markblom
Frequent Visitor

Show 0 instead of blank

Hi,

 

I would like to show 0's instead of blanks in a table showing sales and purchases for products. I have created a dummy report to show what issue I am running into. 

 

The dummy report has 3 tables:

  • Products: Product
  • Sales: Product, Date, Quantity
  • Purchases: Product, Date, Quantity

I have created to measures:

  • Sum of Purchases = CALCULATE(SUM(Purchases[Quantity]))
  • Sum of Sales = CALCULATE(SUM(Sales[Quantity]))

I created a table with three columns:

  • Product
  • Sum of Purchases
  • Sum of Sales

Below you will find a screenshot of the outcome:

In the middle table only the products are shown that have a purchase of sales. But for product C, the sales column is blank. Here, I would like to display 0.

 

I then tried another measure:

  • Sum of Sales Zero = CALCULATE(SUM(Sales[Quantity])) + 0

The table on the right show the outcome with that column. Now it shows 0's but now all products are shown in the table.

 

What can I do to only show products that either have sales or purchases with the value 0 instead of a blank?

markblom_0-1714745265853.png

 

Regards,

 

Mark

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@markblom Try:

Sum of Sales Zero =
  VAR __Result = IF( [Sum of Purchases] = BLANK() && [Sum of Sales] = BLANK(), BLANK(), SUM(Sales[Quantity]) + 0
RETURN
  __Result

Also, there is no reason for your CALCULATE statements wrapping your SUM functions



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
markblom
Frequent Visitor

Thanks, that works!

Greg_Deckler
Community Champion
Community Champion

@markblom Try:

Sum of Sales Zero =
  VAR __Result = IF( [Sum of Purchases] = BLANK() && [Sum of Sales] = BLANK(), BLANK(), SUM(Sales[Quantity]) + 0
RETURN
  __Result

Also, there is no reason for your CALCULATE statements wrapping your SUM functions



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.