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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

100% Stacked Chart + Line Chart Calculation

Hi all,

 

I'm trying to develop a combo chart that is essentially a 100% stacked bar chart + a line graph. I have looked at previous answers for this and they have suggested using the following measure calc for the 100% stacked bar chart:

 

 

 

100pct = 
VAR Val1AllCats = CALCULATE( SUM( Table1[val1] ), ALL( Table1[cat] ) )
RETURN
DIVIDE( SUM( Table1[val1] ), Val1AllCats ) 

 

 

 

I believe in previous tests this used to work, but seems like this is no longer the case and I get 100% for each column series grouping of the bar, as opposed to the percentage break down of a 100% total. Any ideas on what this could be?

bnguyenab_0-1638397924079.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I actually resolved the issue myself after reviewing what was done in the dashboard. If you change the sort column of the category within the calculation to be a different field, it will nullify the context (e.g. I sorted the category field by 'category_sort_order' field). In order to remediate this I simply needed to add the sort_order field to the calculation as well.

 

100pct = 
VAR Val1AllCats = CALCULATE( SUM( Table1[val1] ), ALL( Table1[cat], Table1[cat_sort_order] ))
RETURN
DIVIDE( SUM( Table1[val1] ), Val1AllCats ) 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

I actually resolved the issue myself after reviewing what was done in the dashboard. If you change the sort column of the category within the calculation to be a different field, it will nullify the context (e.g. I sorted the category field by 'category_sort_order' field). In order to remediate this I simply needed to add the sort_order field to the calculation as well.

 

100pct = 
VAR Val1AllCats = CALCULATE( SUM( Table1[val1] ), ALL( Table1[cat], Table1[cat_sort_order] ))
RETURN
DIVIDE( SUM( Table1[val1] ), Val1AllCats ) 
Ashish_Mathur
Super User
Super User

Hi,

Share the link from where i can download your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors