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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
MarkSL
Helper V
Helper V

Matrix show missing values as zero - pbix attached

Hi,

 

It seems that this is a common question, but even from reading the many posts I am still stuck so I would really appreciate some assistance!

 

My model has:

2 dim tabes: Date, Products.

2 fact tables: Sales, Purchases.

 

Matrix3.png

 

I create a Matrix with ProductName from Products on the Row and then SalesQty and StockQty from Sales and Purchases as my values:

 

This all looks ok, except I have blanks for where no sales or purchase were found:

Matrix1.png

 

So from reading up on this issue, I see that the ISBLANK() function can be used, but it needs to be on a measure.  So I created a measure over SalesQty:

 

SalesQtyMeasure = IF(ISBLANK(SUMX(SALES, Sales[SalesQty])), 0, SUMX(SALES, Sales[SalesQty]))

 

However, when I add this to my Matrix, it changes the blanks to zeros, BUT it also brings in rows where I have no purchase or sales - eg: Oranges.  

 

Matrix2.png

 

 

The above is purely sample data for the purpose of this demonstation.  For my actual report this is a big problem as it is adding thousands of rows to the matrix which I do not want to see.  But I do need zeros instead of blanks, 1 for the readability of the report but also for 2, I want to do conditional formatting where SalesQty is between 0 and 5 for instance.

 

 

The pbix file can be found here:   https://www.dropbox.com/s/fi175a301annhpj/FruitDemo.pbix?dl=0

 

Any assistance here greatly appreciated!

 

Mark

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hey @MarkSL,

 

I added a stockqty measure and a hasdata measure and filtered based on hasdata.

 

StockQtyMeasure = IF(ISBLANK(SUMX(Purchases, Purchases[StockQty])), 0,SUMX(Purchases, Purchases[StockQty]))

HasData = IF(AND(Sales[SalesQtyMeasure]=0,[StockQtyMeasure]=0),"No","Yes")

 

HasData.PNG

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hey @MarkSL,

 

I added a stockqty measure and a hasdata measure and filtered based on hasdata.

 

StockQtyMeasure = IF(ISBLANK(SUMX(Purchases, Purchases[StockQty])), 0,SUMX(Purchases, Purchases[StockQty]))

HasData = IF(AND(Sales[SalesQtyMeasure]=0,[StockQtyMeasure]=0),"No","Yes")

 

HasData.PNG

Hi @Anonymous

 

That did the trick!  Many thanks, really appreciate it 🙂

 

Cheers

 

Mark

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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