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
powerbiusertest
Frequent Visitor

Calculate percentage based on column values and display in Stacked

HI,

 I am new to PowerBI and have been exploring my usecase but couldnt find a solution. Can somehelp on how i can achieve this?

 

I need to create a Stacked column chart with date in X-axis and in Y-axis i want to add up Col to Col 5 to how 100%

Here Col1 - 20% , Col 2 - 25%, Col 3 - 30%, col 4 - 10%, Col 5 - 15%. Basically, i am determining how much each column % is instead of distributing same % for all the columns.  

 

I tried to select Col 1 - Col 5 & Unpivot these selected columns and tried to use Marix visualization but i can only convert columns to rows (Attribute and Value) and get the counts. If i change to % of GT, then i am getting equal % for all the columns.

Also, how can i show % of Yes, No values in Col1, Col2 instead of showing percentage of columns. 

 Screenshot 2023-03-26 at 6.32.39 PM.png

 

Screenshot 2023-03-26 at 6.40.54 PM.pngScreenshot 2023-03-26 at 6.41.08 PM.png

3 REPLIES 3
powerbiusertest
Frequent Visitor

Anyone has suggestions on this? 

amitchandak
Super User
Super User

@powerbiusertest , my advice would be to unpivot the data then % of total and subtotal can help

 

Unpivot Data(Power Query): https://youtu.be/2HjkBtxSM0g

 

Percent of Total and Percent of SubTotal https://www.youtube.com/watch?v=6jTildcV2ho
https://www.youtube.com/watch?v=cN8AO3_vmlY&t=24270s

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

Thanks @amitchandak ! 

I cannot figure out how can i achieve Col1 - 20% , Col 2 - 25%, Col 3 - 30%, col 4 - 10%, Col 5 - 15%. 

 

I am trying if i can add an IF or SWITCH in my measure to verify the attribute and then set the desired % but i cannot use 'Table'[Attribute]="Col1" in the IF or SWITCH, seeing an error cannot find name for Attribute

 

Below measure gives same 20% across all the attributes Col1 to Col7 but i want to set different percentages and i cannot use Attribute in condition.

% of QA = DIVIDE('Table'[count],CALCULATE('Table'[count],All('Table'[Value])) ) *20 /100
Can you help on how my measure should be written? 
 
Screenshot 2023-03-27 at 3.17.59 PM.png

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

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!

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
Top Kudoed Authors