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
Charu
Post Patron
Post Patron

Condition to count/sum/avg including blank in power bi

Hi Everyone,

 

I need to take count includes blank help me to achieve this, here is the sample for your reference

countwitnull.PNG

I need to display the Customer count with blank also and when I filter based on Id suppose Id is 1 then the count of a customer is 1 and when Id is 5 the count of a customer should display Zero as It's blank

 

how to create the measure for this logic?

one measure which takes the count of all rows includes blank and then when I filter for blank row it should display as ZEro

 

thanks in advance

1 ACCEPTED SOLUTION

Hi @Charu

 

Please try this then

 

Measure =
VAR mymeasure =
    IF (
        ISCROSSFILTERED ( Table1[Customer] ),
        COUNT ( Table1[Customer] ),
        CALCULATE ( COUNT ( Table1[Customer] ), Table1[Customer] <> BLANK () )
    )
RETURN
    IF ( ISBLANK ( mymeasure ), 0, mymeasure )

Regards
Zubair

Please try my custom visuals

View solution in original post

4 REPLIES 4
Zubair_Muhammad
Community Champion
Community Champion

Hi @Charu

 

Please try this MEASURE

 

Measure =
IF (
    ISCROSSFILTERED ( Table1[Customer] ),
    COUNT ( Table1[Customer] ),
    CALCULATE ( COUNT ( Table1[Customer] ), Table1[Customer] <> BLANK () )
)

Regards
Zubair

Please try my custom visuals

HI @Zubair_Muhammad

I tried this measure It's returning (Blank) when I select Id =5,Instead blank I need to display ZEro

Hi @Charu

 

Please try this then

 

Measure =
VAR mymeasure =
    IF (
        ISCROSSFILTERED ( Table1[Customer] ),
        COUNT ( Table1[Customer] ),
        CALCULATE ( COUNT ( Table1[Customer] ), Table1[Customer] <> BLANK () )
    )
RETURN
    IF ( ISBLANK ( mymeasure ), 0, mymeasure )

Regards
Zubair

Please try my custom visuals

Thanks a lot, It's working...

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.