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
You need a disconnected table for your legend that lists your groups and then something like "MaxCount". Then a measure that returns the correct values based upon the slicer value. See the Disconnected Table Trick as this article demonstrates: https://community.powerbi.com/t5/Community-Blog/Solving-Attendance-with-the-Disconnected-Table-Trick/ba-p/279563
Thank you for your quick reply but I do not understand how that would fit into my issue
It seems, if i can group by, pivot the WorkData table by category and merge the data by groupName to extract MaxCount, i would be able to easily plot the graph. I tested this in Excel but still cannot figure out how to acheive the same in power bi