Forum Discussion
Stacked bar chart help to use multiple values
- 6 years ago
Hi,
Please try to create this table first:
Table = UNION(DISTINCT('WorkData'[Category]),{{"MaxCount"}})Then try this measure:
Measure = SWITCH(SELECTEDVALUE('Table'[Category]),"MaxCount",MAX('GroupData'[MaxCount]),CALCULATE(SUM(WorkData[Count]),FILTER('WorkData','WorkData'[Category] in DISTINCT('Table'[Category]))))The result shows:
Here is my changed pbix file:
Best Regards,
Giotto Zhi
Hi,
According to your description, i choose GroupData and WorkData tables to test without calendar table.
Then try to create a calculated column first:
Group&Category = WorkData[GroupName]&"-"&WorkData[Category]Try this measure:
Max Count = CALCULATE(SUM(GroupData[MaxCount]),FILTER(WorkData,WorkData[GroupName] in FILTERS(GroupData[GroupName])))Choose the above column,measure and [Count] as a stacked bar chart, it shows:
Here is my test pbix file:
Hope this helps.
Best Regards,
Giotto Zhi
Thank you for you help but requirement has changed and this isn't needed any more. The output i was looking for is as below. Also, legend needs to show the category names
- Anonymous6 years agoNot applicable
- v-gizhi-msft6 years agoCommunity Support
Hi,
Please try to create this table first:
Table = UNION(DISTINCT('WorkData'[Category]),{{"MaxCount"}})Then try this measure:
Measure = SWITCH(SELECTEDVALUE('Table'[Category]),"MaxCount",MAX('GroupData'[MaxCount]),CALCULATE(SUM(WorkData[Count]),FILTER('WorkData','WorkData'[Category] in DISTINCT('Table'[Category]))))The result shows:
Here is my changed pbix file:
Best Regards,
Giotto Zhi
- v-gizhi-msft6 years agoCommunity Support
Hi,
If my answer has solved your issue, please mark it as a solution for others to see.
Thanks!
Best Regards,
Giotto Zhi