Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello,
I have got a below data:
Country | Company | Category |
X | AB | A |
Z | AC | A |
Y | AD | B |
Y | AB | C |
X | AD | B |
Z | AB | A |
X | AC | B |
X | AB | C |
Y | AC | A |
Z | AB | A |
I was using below measure CategoryPercentage =
DIVIDE(
COUNT('YourTable'[Category]),
CALCULATE(COUNT('YourTable'[Category]), ALL('YourTable')),
0
)
to get the % but the when I use slicer of country or company the numerator gets slicer but due to ALL function demominator count of category remains same which makes category in that country divided by again total count of column rather then sliced by country slicer. I want if I do not select slicer then each category divide by total column count. But if I select slicer of country then each category available in that country divde by the category column count which was in that country.
Basically I was looking to see only top 5 Categories % as all or once they are sliced by slicer of country and company.
Your hel would be highly appreciated.
Thank you
Solved! Go to Solution.
Hi @PowerBI__ Try this:
CategoryPercentage =
DIVIDE(
COUNT('YourTable'[Category]),
CALCULATE(
COUNT('YourTable'[Category]),
REMOVEFILTERS('YourTable'[Category])
),
0
)
To show only the top 5 categories by percentage, you can use a visual-level filter:
Hope this helps!!
If this solved your problem, please accept it as a solution and a kudos!!
Best Regards,
Shahariar Hafiz
Hi @PowerBI__ Try this:
CategoryPercentage =
DIVIDE(
COUNT('YourTable'[Category]),
CALCULATE(
COUNT('YourTable'[Category]),
REMOVEFILTERS('YourTable'[Category])
),
0
)
To show only the top 5 categories by percentage, you can use a visual-level filter:
Hope this helps!!
If this solved your problem, please accept it as a solution and a kudos!!
Best Regards,
Shahariar Hafiz
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
79 | |
73 | |
57 | |
36 | |
31 |
User | Count |
---|---|
91 | |
60 | |
59 | |
49 | |
45 |