Forum Discussion
RankX- user to enter desired number to filter the RankX results of matrix is not working
I have a matrix in Power BI and
measures for Revenue Year 1; Revenues Year 2; RankX
parameters for Revenue Year 1; Revenue Year 2 ; TopN- for the users to choose the top count where I have a Rankif function
in the filter pane
| Customer | 2024 | 2025 | Dynamic Rank Compare 2024 -> 2025 or 2025->2024 |
| A | 90 | 50 | 1 |
| B | 50 | 60 | 2 |
| C | 40 | 40 | 3 |
| D | 10 | 20 | 4 |
| E | 6 | 70 | 5 |
Everything is working except the RankIf in filterpane so that user cannot enter manually how many top rows to display. I don't know where exactly I am going wrong. I tried to replicate the same in the attcahed below
Hi ribs ,
You can try this DAXRankX =IF(ISINSCOPE('Customer'[Customer Name]) && NOT ISINSCOPE('Customer'[Customer No.]),RANKX(ALLSELECTED('Customer'[Customer Name]),[Revenue Change],,DESC,DENSE))
This makes Rankx return blank at the Customer No. level, so it doesn’t affect or show on subcategories.
Attached file for reference.
Hope this helps!
If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank You!
6 Replies
- v-sdhruv
Community Support
Hi ribs ,
You can try this DAXRankX =IF(ISINSCOPE('Customer'[Customer Name]) && NOT ISINSCOPE('Customer'[Customer No.]),RANKX(ALLSELECTED('Customer'[Customer Name]),[Revenue Change],,DESC,DENSE))
This makes Rankx return blank at the Customer No. level, so it doesn’t affect or show on subcategories.
Attached file for reference.
Hope this helps!
If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank You! - bhanu_gautam
Super User
ribs Try using
RankX Measure: RankX = RANKX(ALL('Customer'), [Revenue Year 1], , DESC, DENSE)
RankIf Measure: RankIf = IF([RankX] <= SELECTEDVALUE('TopN'[TopN Value]), 1, 0)
TopN Parameter Table: TopN = GENERATESERIES(1, 10, 1)
Go to the matrix visual.
Drag the RankIf measure to the Visual Level Filters pane.
Set the filter to show only rows where RankIf equals 1. - ribs
Helper I
bhanu_gautam I have tried this already it is not working.In the matrix rows pane I have two columns- Customer and Customer No like the image below. Because of the subategory Customer No, the RankIf is not working. Is it possible to not to apply ranking to the subcategory? Or if at all applied, not to cosnider in RankIf()?