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
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
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.