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
Sm95
Frequent Visitor

Showing null/blank values as 0 in matrix causing all dates to show

Hi All,

I have a requirement to show the blank values in my matrix as 0 with my date in column shelf of matrix. But when I use my created measure in the matrix, it starts showing all the dates (which are not even part of my data).

I have tried various suggestions provided to use a different date table, link it with primary table and use it in the matrix. But I am still getting the same result (i.e. all months). Please help with your inputs or alternative suggestions. Below is my scenario in detail.

1) Original Output:

Sm95_0-1654847402917.png

 

2) Created measure to show as 0:

Sales_ZN = SUM('Table'[Sales])+0
 

3) Result with Sales_ZN measure: (showing all the months)

Sm95_2-1654847566651.png

Getting the same output when creating a separate date table, linking it with original primary table and using the date field in matrix.

4) Expected Output:

Sm95_3-1654847724767.png

 

Thanks!

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @Sm95 ,

 

Try this formula:

Sales_ZN =
IF (
    ISBLANK (
        CALCULATE (
            MAX ( 'Table'[Sales] ),
            ALLEXCEPT ( 'Table', 'Table'[Year], 'Table'[Month] )
        )
    ),
    BLANK (),
    SUM ( 'Table'[Sales] ) + 0
)

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

3 REPLIES 3
Sm95
Frequent Visitor

Hi @v-jayw-msft , 

 

Thanks a lot for the suggestion. This is working as expected. Just a question, could you please explain why have you used MAX function in CALCULATE? I got the expected values using SUM as well, instead of MAX.

 

CALCULATE (
            MAX ( 'Table'[Sales] ),
            ALLEXCEPT ( 'Table', 'Table'[Year], 'Table'[Month] )
        )

 

Hi @Sm95 ,

 

Yes, you could use SUM() as well.

If the all the value in that column is blank, both max and sum will be blank.

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
v-jayw-msft
Community Support
Community Support

Hi @Sm95 ,

 

Try this formula:

Sales_ZN =
IF (
    ISBLANK (
        CALCULATE (
            MAX ( 'Table'[Sales] ),
            ALLEXCEPT ( 'Table', 'Table'[Year], 'Table'[Month] )
        )
    ),
    BLANK (),
    SUM ( 'Table'[Sales] ) + 0
)

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

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.