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
natasha519
Helper II
Helper II

Calculating Percentages of a Binary column

Hi,

 

I am trying to 1) calculate the percentages of attendance (binary column 1 =attended 0 =not attended) for 10 different modules. The format of the columns is below: 

Module 1Module 2Module 3 Module 4 etc. 
1011
1101
0100

 

Once I have the percentages of attendance for each of the 10 modules, I would then like to display that in a bar graph showing each of the 10 modules on the x axis and then the percentages on the y. 

 

I created the following measure for one of the modules but am having issues when creating the bar chart.  

 

% attended live mod1 =
DIVIDE (
CALCULATE ( COUNT ( 'Excel File'[LIVEMOD1] ), 'Excel File'[LIVEMOD1] = 1 ),
CALCULATE ( COUNT ( 'Excel File'[LIVEMOD1] ), ALLSELECTED ( 'Excel File'[LIVEMOD1] ) )
)

is this possible to achieve with how the data is formatted?
3 REPLIES 3
ryan_mayu
Super User
Super User

@natasha519 

is the table your sample data?

What's the expected output?

module 1    66.6%

module 2   33.3%

module 3  66.6%

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




yes the sample data is the table above and expected output is ultimately a bar chart with the modules on the x x axis and the percentages for each on the y axis

@natasha519 

you can try this

in PQ

1, use header as first row

1.png

2. transpose

2.PNG

3. select first column and unpivot other columns

3.PNG

 

then you can create measure (make sure the data type of value column is whole number)

Measure = sum('Table'[Value])/COUNTROWS('Table')

1.png

 

pls see the attachment below

 

 





Did I answer your question? Mark my post as a solution!

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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