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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
byzmjv
Regular Visitor

Cannot Replace Blank Values with 0 in Matrix, Data is Multiplied

Hello,

I have a problem with my measures. 

I have two measures, and a matrix report. In my matrix report, if there is no data, I want to show 0 instead of blank. 

When I add first measure only itself, it shows the changes. 

But when I add other measure, zero values disappears and I see only blanks. Also, if I add if condition to my first measure and add to matrix, data is multiplied for every record. 

Second measure is calculated from the first measure. 

I couldn't find any proper solution or solution approach to my problem. 

If there is anyone to help me I'll appreciate. 

Thanks

 

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

Hi @byzmjv ,

You can refer the following links to get it:

Handling BLANK in Power BI

Solution #1: Using IF

Blank v1 comments =
IF (
    ISBLANK (
        CALCULATE (
            COUNT ( Comments[Id] ),
            FILTER ( Comments, Comments[Year Comment] = 2012 )
        )
    ),
    0,
    [Total Comments]
)

Solution #2: COALESCE()

Blank v2 Comments coal =
COALESCE (
    CALCULATE (
        COUNT ( Comments[Id] ),
        FILTER ( Comments, Comments[Year Comment] = 2012 )
    ),
    0
)

Solution #3 Trick with 0

Blank v3 Comments 0 =
CALCULATE (
    COUNT ( Comments[Id] ),
    FILTER ( Comments, Comments[Year Comment] = 2012 )
) + 0

How to return 0 instead of BLANK in DAX

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

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

View solution in original post

2 REPLIES 2
v-yiruan-msft
Community Support
Community Support

Hi @byzmjv ,

You can refer the following links to get it:

Handling BLANK in Power BI

Solution #1: Using IF

Blank v1 comments =
IF (
    ISBLANK (
        CALCULATE (
            COUNT ( Comments[Id] ),
            FILTER ( Comments, Comments[Year Comment] = 2012 )
        )
    ),
    0,
    [Total Comments]
)

Solution #2: COALESCE()

Blank v2 Comments coal =
COALESCE (
    CALCULATE (
        COUNT ( Comments[Id] ),
        FILTER ( Comments, Comments[Year Comment] = 2012 )
    ),
    0
)

Solution #3 Trick with 0

Blank v3 Comments 0 =
CALCULATE (
    COUNT ( Comments[Id] ),
    FILTER ( Comments, Comments[Year Comment] = 2012 )
) + 0

How to return 0 instead of BLANK in DAX

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
djurecicK2
Super User
Super User

Hi @byzmjv ,

 Could you post some screenshots and measures? 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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