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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Sisko
Helper I
Helper I

IF and calculation

Hi, how can I calculated that how many value '1' and value '0' appears in the column?

 

help.PNG

 

Thanks for help!

 

1 ACCEPTED SOLUTION
zoloturu
Memorable Member
Memorable Member

Hi @Sisko ,

 

Calc_0_and_1 =
CALCULATE (
    COUNT ( 'Table'[Column1] ),
    'Table'[Column1] = 0
        || 'Table'[Column1] = 1
)

This calculation does count of values in a field 'Table'[Column1] with either 0 either 1 value.

 

|| symbol is an equivalent of OR. So you can solve it in another way as well:

 

Calc_0_and_1 =
CALCULATE (
    COUNT ( 'Table'[Column1] ),
    OR ( 'Table'[Column1] = 0, 'Table'[Column1] = 1 )
)

The only difference between OR and || symbol that, actually OR is limited to 2 arguments.

 

Regards,
Ruslan
-------------------------------------------------------------------
Did I answer your question? Mark my post as a solution!

View solution in original post

3 REPLIES 3
zoloturu
Memorable Member
Memorable Member

Hi @Sisko ,

 

Calc_0_and_1 =
CALCULATE (
    COUNT ( 'Table'[Column1] ),
    'Table'[Column1] = 0
        || 'Table'[Column1] = 1
)

This calculation does count of values in a field 'Table'[Column1] with either 0 either 1 value.

 

|| symbol is an equivalent of OR. So you can solve it in another way as well:

 

Calc_0_and_1 =
CALCULATE (
    COUNT ( 'Table'[Column1] ),
    OR ( 'Table'[Column1] = 0, 'Table'[Column1] = 1 )
)

The only difference between OR and || symbol that, actually OR is limited to 2 arguments.

 

Regards,
Ruslan
-------------------------------------------------------------------
Did I answer your question? Mark my post as a solution!

RobbeVL
Impactful Individual
Impactful Individual

Calc_0_and_1 = 
CALCULATE (
    COUNT ( 'Table'[Column1] ),
    'Table'[Column1]  IN {0,1}
)

 

Just to give some more options! 🙂 

 

Robbe 

RobbeVL
Impactful Individual
Impactful Individual

You will have to Use CALCULATE:

CALCULATE( COUNT(XXX), Category =0 || 1 ) 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.