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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.