March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello and happy new year.
I have a RANKX formula that gives out the rank of sales people based on specific KPIs.
A slicer on a page changes the KPI on which sales people are ranked.
IF (
SELECTEDVALUE ( RankMethod[Flag] ) = 1,
RANKX ( ALLNOBLANKROW ( [SALES REP] ), [KPI_0] ),
IF (
SELECTEDVALUE ( RankMethod[Flag] ) = 2,
RANKX ( ALLNOBLANKROW ( [SALES REP] ), [KPI_1] ),
IF (
SELECTEDVALUE ( RankMethod[Flag] ) = 3,
RANKX (
ALLNOBLANKROW ( [SALES REP] ),[KPI_2] ),
RANKX (
ALLNOBLANKROW ( [SALES REP] ),[KPI_3]
)
This is an extract of my formula (RankAll). It works for what I need, however I there is an issue with a specific visual.
When I put the KPI_0 and another measure (KPI_0 vs Target) to build the Measure Absolute and Measure Deviation in the custom Scroller visual, I can't use my RANKX formula to filter on a specific Sales individual.
When looking at the scroller for the #2 individual, applying RankAll = 2 in PBI filters doesn't work. This might be caused by the fact that I use a product category in this visual, which breaks my Ranking Formula.
Is there a way to write the RANKX formula to work when I apply categories, or filter for only a specific Sales individual ?
I have tried multiple ways, including a formula that gives out the name (string) of the #x individual :
Solved! Go to Solution.
Ok so I solved it.
I can't pass the rankx formula in the filter fields, as it breaks. I couldn't also use it to generate a new DAX table, because I have report-wide filters, and it would not capture them.
So what I did was, create 3 measures that yields the name of Sales individual 1,2 and 3 each. Then pass the Sales individual name as filter on visual, select TOP n of this measure. Works perfectly.
Not pretty, but I got what I needed.
@Stemar_Aubert how your tables are connected? Seems like you have to remove filter from product category. To simply test it, put a table visual, add sales person and product category and rank measure in it and see if your rank is showing expected result, if not that is your problem and need to be fixed.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hello @parry2k ,
You are correct. The table doesn't yield what I need and product categories mess up my RankAll formula.
I created another Rank formula which "holds", meaning it will always give the same rank to an individual, even on a table showing product categories.
TEST =
CALCULATE (
RANKX (
ALLNOBLANKROW ( Reps[INDUSTRY REP] ),
[KPI_4]
),
ALLSELECTED ( Machine[PRODUCT FAMILY] )
)
However it still doesn't work when I use it as a filter in the custom visual and seems broken. Filtering on "TEST is 2" for exemple, the visual displays nothing at all.
@Stemar_Aubert IN which visual it is not working? How you are filtering it? Can you share that info please?
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
I am using this custom visual :
https://appsource.microsoft.com/en-us/product/power-bi-visuals/WA104381018?tab=Overview
As you can see, if I filter using the Sales rep name, it works (data is scrolling correctly).
But when I use the TEST measure to filter, it doesn't give anything.
Thanks !
Ok so I solved it.
I can't pass the rankx formula in the filter fields, as it breaks. I couldn't also use it to generate a new DAX table, because I have report-wide filters, and it would not capture them.
So what I did was, create 3 measures that yields the name of Sales individual 1,2 and 3 each. Then pass the Sales individual name as filter on visual, select TOP n of this measure. Works perfectly.
Not pretty, but I got what I needed.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
133 | |
91 | |
88 | |
64 | |
58 |
User | Count |
---|---|
201 | |
137 | |
107 | |
73 | |
68 |