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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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