Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I have a matrix where I am using a measure to show only the top N firms (along the lines of this post). However, I would like the totals shown in the matrix to be the unfiltered totals, that is, for all firms, and not only for the top N firms. The matrix has a hierarchy of Category -> Firm, and I would like to show the top N firms within each category. To illustrate, in the image below is the matrix before being filtered.
If I apply the top N filter and show only the, say, top 5 firms, I currently get the below.
However, what I would like is for the totals to remain unchanged, as in the image below.
I find it very tricky to do this as the filter is a measure, so I cannot simply use REMOVEFILTERS or something like that. There are many external filters that should be possible to apply to the matrix, so using ALL is not an option either.
The data is provided in the table at the bottom. I am using the following DAX objects currently.
TopN_Filter_Table = GENERATESERIES(1, 10, 1)Sum_of_amount = SUM(Table1[Amount])RankX_Measure =
VAR _CAT = MAX(Table1[Category])
RETURN
RANKX(
FILTER(
ALLSELECTED(Table1),
Table1[Category] = _CAT
),
CALCULATE(
[Sum_of_amount],
ALLEXCEPT(
Table1,
Table1[Category],
Table1[Firm]
)
),,, DENSE
)TopN_Filter_Measure =
IF(
[RankX_Measure]<=SELECTEDVALUE(TopN_Filter_Table[Top N], 11),
1,
0
)
I then apply the TopN_Filter_Measure to the filter pane of the matrix and filter it as TopN_Filter_Measure = 1.
| Category | Firm | Amount |
| Category1 | Firm1 | 3141 |
| Category1 | Firm2 | 926 |
| Category1 | Firm3 | 535 |
| Category1 | Firm4 | 89 |
| Category1 | Firm5 | 79 |
| Category1 | Firm6 | 323 |
| Category1 | Firm7 | 8462 |
| Category1 | Firm8 | 64 |
| Category1 | Firm9 | 338 |
| Category1 | Firm10 | 3279 |
| Category1 | Firm1 | 27 |
| Category1 | Firm2 | 182 |
| Category1 | Firm3 | 818 |
| Category1 | Firm4 | 28 |
| Category1 | Firm5 | 45 |
| Category1 | Firm6 | 90 |
| Category1 | Firm7 | 4523 |
| Category1 | Firm8 | 53 |
| Category1 | Firm9 | 60 |
| Category1 | Firm10 | 287 |
| Category1 | Firm1 | 161 |
| Category1 | Firm2 | 80 |
| Category1 | Firm3 | 339 |
| Category1 | Firm4 | 887 |
| Category1 | Firm5 | 49 |
| Category1 | Firm6 | 89 |
| Category1 | Firm7 | 4848 |
| Category1 | Firm8 | 204 |
| Category1 | Firm9 | 586 |
| Category1 | Firm10 | 834 |
| Category2 | Firm1 | 120 |
| Category2 | Firm2 | 205 |
| Category2 | Firm3 | 6 |
| Category2 | Firm4 | 903 |
| Category2 | Firm5 | 159 |
| Category2 | Firm6 | 5942 |
| Category2 | Firm7 | 85 |
| Category2 | Firm8 | 399 |
| Category2 | Firm9 | 73 |
| Category2 | Firm10 | 8161 |
| Category2 | Firm1 | 164 |
| Category2 | Firm2 | 493 |
| Category2 | Firm3 | 4066 |
| Category2 | Firm4 | 848 |
| Category2 | Firm5 | 226 |
| Category2 | Firm6 | 436 |
| Category2 | Firm7 | 47 |
| Category2 | Firm8 | 241 |
| Category2 | Firm9 | 516 |
| Category2 | Firm10 | 664 |
Solved! Go to Solution.
I think that you can adapt the technique described in https://www.sqlbi.com/articles/filtering-the-top-products-alongside-the-other-products-in-power-bi/ to achieve what you're looking for.
One option would be to rename the "Others" row "Total", and calculate as the sum of Others + the values actually shown.
I think that you can adapt the technique described in https://www.sqlbi.com/articles/filtering-the-top-products-alongside-the-other-products-in-power-bi/ to achieve what you're looking for.
One option would be to rename the "Others" row "Total", and calculate as the sum of Others + the values actually shown.
This is excellent, thank you very much! I'll write a reply with my final solution when I have it, for anyone interested.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 97 | |
| 73 | |
| 50 | |
| 48 | |
| 45 |