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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
bh_prism
New Member

Count True/False and represent in chart using percentage

Hey guys

 

Hopefully someone can help. I have two columns in a table which reports TRUE or FALSE based on criteria being met.

 

I wish to have the count of TRUE/FALSE and represent the difference between 8 TRUE and 2 FALSE as 80% / 20% in a visual chart. 

 

How is this possible, I have played with Measures and filters but cant seem to get it working as I need it. 

 

Thanks, Ben

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @bh_prism ,

 

If I understand you correctly, put the below measure into a card visual and you'll get what you want:

TRUE/FALSE =
VAR TRUE_ =
    CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Column1] = TRUE () )
        + CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Column2] = TRUE () )
VAR FALSE_ =
    CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Column1] = FALSE () )
        + CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Column2] = FALSE () )
VAR Total_ =
    COUNTROWS ( 'Table' ) * 2
VAR TRUE_Percent =
    DIVIDE ( TRUE_, Total_, BLANK () )
VAR FALSE_Percent =
    DIVIDE ( FALSE_, Total_, BLANK () )
RETURN
    TRUE_Percent & " / " & FALSE_Percent

 

 

Best Regards,

Icey

 

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

5 REPLIES 5
Icey
Community Support
Community Support

Hi @bh_prism ,

 

If I understand you correctly, put the below measure into a card visual and you'll get what you want:

TRUE/FALSE =
VAR TRUE_ =
    CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Column1] = TRUE () )
        + CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Column2] = TRUE () )
VAR FALSE_ =
    CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Column1] = FALSE () )
        + CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Column2] = FALSE () )
VAR Total_ =
    COUNTROWS ( 'Table' ) * 2
VAR TRUE_Percent =
    DIVIDE ( TRUE_, Total_, BLANK () )
VAR FALSE_Percent =
    DIVIDE ( FALSE_, Total_, BLANK () )
RETURN
    TRUE_Percent & " / " & FALSE_Percent

 

 

Best Regards,

Icey

 

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

amitchandak
Super User
Super User

@bh_prism , you can have measures like these

divide(calculate(countrows(Table), table[flag]= "True"),calculate(countrows(Table))) // if boolean , table[flag]= True()
divide(calculate(countrows(Table), table[flag]= "False"),calculate(countrows(Table))) // if boolean , table[flag]= False()

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
tex628
Community Champion
Community Champion

Does the columns have the boolean true/false data type?


Connect on LinkedIn

Hi, yes it is boolean data type. Thanks

tex628
Community Champion
Community Champion

Try these two measures:

True = 
VAR True_ = CALCULATE(COUNTROWS('Table') , 'Table'[Column1] = TRUE())
VAR Total = COUNTROWS('Table')
Return
DIVIDE(True_,total,blank())
False = 
VAR Total = COUNTROWS('Table')
VAR False_ = CALCULATE(COUNTROWS('Table') , 'Table'[Column1] = FALSE())
Return
DIVIDE(False_,Total,BLANK())


They calculate the % for one column. Use them together in a chart to get the distribution for that column.

/ J

 


Connect on LinkedIn

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Solution Authors