Forum Discussion

byzmjv's avatar
byzmjv
Regular Visitor
3 years ago
Solved

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 its...
  • Anonymous's avatar
    Anonymous
    3 years ago

    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