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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Class66Loco
Advocate I
Advocate I

Percentage of two column totals?

Hello,

I have two boolean columns (A and B) which contain 1s and 0s where the other doesn't.

I know it should be simple but I can't figure out how to display the two column totals as a percentage.

It'd be something like A: 40% B:60%.

Thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Class66Loco 

 

Based on your needs, I have created the following table.

vjialongymsft_0-1716860187656.png

You can use the following measure to calculate the percentage of the number 1 in column A and the number 0 in column B.

A% = 
VAR Total_Rows = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[A]=1)) + CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[B]=0))
VAR Count_A = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[A]=1))
RETURN Count_A / Total_Rows

B% = 
VAR Total_Rows = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[A]=1)) + CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[B]=0))
VAR Count_B = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[B]=0))
RETURN Count_B / Total_Rows

 

This is the result:

vjialongymsft_1-1716860614876.png

 

 

 

 

 

 

Best Regards,

Jayleny

 

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

2 REPLIES 2
Anonymous
Not applicable

Hi @Class66Loco 

 

Based on your needs, I have created the following table.

vjialongymsft_0-1716860187656.png

You can use the following measure to calculate the percentage of the number 1 in column A and the number 0 in column B.

A% = 
VAR Total_Rows = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[A]=1)) + CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[B]=0))
VAR Count_A = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[A]=1))
RETURN Count_A / Total_Rows

B% = 
VAR Total_Rows = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[A]=1)) + CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[B]=0))
VAR Count_B = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[B]=0))
RETURN Count_B / Total_Rows

 

This is the result:

vjialongymsft_1-1716860614876.png

 

 

 

 

 

 

Best Regards,

Jayleny

 

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

PhilipTreacy
Super User
Super User

Hi @Class66Loco 

 

Please supply an example of the data.  Your description isn't clear enough.

 

For example, If you have column A and column B, does only one of them contain 1's and the other contain 0's?  Do they both contain 1 and 0? The bit where the other doesn't is confusing the issue.

 

Are there blanks in the columns?

 

What is the % that you want to measure?  The number of 1's and 0's in each against the total number of rows?

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.