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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
FabioBeka
Frequent Visitor

How to remove empty rows but keep zero counts in countrows matrix?

Hi everybody.

 

I have to build a matrix which shows count frequencies over 3 variables  that form a hierarchy (building-machine-sensor) on a matrix.

We need to show 0 when the combination of the 3 variables has no rows in the table of interest, but we also keep getting an empty row  when we use the countrows function.

FabioBeka_0-1652114882309.png

The matrix is the one on the left  (with a card showing "4" on top).

You can see the dax function on the function toolbar on top.

 

 

 

 

 

Contatore Anomalie Import = COUNTROWS ( DISTINCT('Fact Anomalies Import'[VarKey]))+0

 

 

 

 

 I added the "+0" at the end to show the combinations with null frequencies, but we're also getting the empty row at the top and we can't seem to get rid of it, I also tried using VALUES function instead of DISTINCT but it was of no use.

 

How can we get rid of the empty row but keep the null ones?x

Please help us!

1 REPLY 1
v-stephen-msft
Community Support
Community Support

Hi @FabioBeka ,

 

Try

Contatore Anomalie Import =
VAR _a =
    COUNTROWS ( DISTINCT ( 'Fact Anomalies Import'[VarKey] ) )
RETURN
    IF ( ISBLANK ( _a ), 0, _a )

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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