Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi,
I am looking for some help regarding a bar chart that shows the percentage of the count of a type of subcategory (selected in my filter) based on the total number of a category specified in time. Basically the data I have looks like this:
Category | Week | Subcategory |
A | 1 | x |
A | 2 | y |
A | 2 | x |
A | 2 | z |
A | 2 | y |
A | 2 | y |
A | 3 | x |
A | 3 | z |
A | 3 | x |
B | 3 | x |
B | 3 | y |
C | 1 | z |
And I want to apply the following filters:
Filter on Category | A |
Filter on Subcategory | x |
Filter on week | [All] |
After which I want to show the percentage of counted "x" relative to the total count of "A" per week, i.e. a result (in a bar graph that basically shows:
Category | Subcategory | Week | % of Category |
A | x | 1 | 100% |
2 | 20% | ||
3 | 67% |
So far, my attempts have not gotten me far (not very experienced yet) and when using metrics to calculate totals and percentages, the Category "A" changes with the filter "x". In other words I keep getting 100% as an outcome in the end. Could someone help me with this?
Thanks a lot!
Solved! Go to Solution.
Try this MEASURE
% of category = DIVIDE ( COUNT ( TableName[Subcategory] ), CALCULATE ( COUNT ( TableName[Subcategory] ), ALLEXCEPT ( TableName, TableName[Category], TableName[Week ] ) ) )
Hi,
This is good, it is working in matrix table, but not working for bar chart.... here is the scenario:
i have data of around 10k records with consists of name, months, multiple subcategories (poor, good, very good, excellent) in column1
My question is i want to display month wise % of good, poor, very good, excellenet in bar chart.. i wnat to display & on each bar.
Hi,
Share data in a format that can b pasted in an MS Excel file. Ensure that there is also a Year column (along with Month column) in your dataset.
Hi,
Try this measure
=COUNTROWS(Table1)/CALCULATE(COUNTROWS(Table1),ALL(Table1[Subcategory]))
Hope this helps.
Thanks, for my specific question this works as well.
Difference with the solution of @Zubair_Muhammad is that with that solution I can select multiple filters (i.e. a second category related to the above data), while keeping the "base value" the same (i.e. the number of "A"'s). With your solution it is possible to select an additional filter, which than becomes the new "base value".
Try this MEASURE
% of category = DIVIDE ( COUNT ( TableName[Subcategory] ), CALCULATE ( COUNT ( TableName[Subcategory] ), ALLEXCEPT ( TableName, TableName[Category], TableName[Week ] ) ) )
But i get different results wth your sample data
My percentages were atually wrong, I will change it in the original answer, solutions works for me!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
124 | |
79 | |
49 | |
38 | |
37 |
User | Count |
---|---|
196 | |
80 | |
70 | |
51 | |
42 |