Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hello, I want to use the Rankx function to evaluate the ten best employees, depending on the number of transactions
processed. This ranking will vary due to the use of filters/Slicers (ex: selection of the province, business line etc.)
Since I have never used the rankx function, I did a search on the web and read the article at the following address:
https://www.sqlbi.com/articles/use-of-rankx-in-power-bi-measures/
To be honest, I did not understand all the subtleties and differences of the scripts.
I don't understand the difference between the following scripts and what we are going to obtain
My interpretation of the above script is: if test[Name] has a value, then rank all the name based on the [ sum value].
If I am wrong, please let me know.
For the script below, I don't understand why we add the test[value] in the function, and how this will affect the result
Feel free to explain how adding test[value] will impact the results
That's why I'm asking for help from the community.
I just want to make sure that when I apply a filter/slicer, I will get the right results.
Imagine that I have a table with Name, Region, Business line , employeeName and the number of transactions treated
by thoses employees.
Those employees are associated to some business line, not all and are also associated to a geographic region
(ex: western region, or Atlantic region and so on).
Therefore, the produced table content will vary due to the use of filter on region and business line and other filters.
Depending on those results, I would like to produce another table which show the top 10 employees based on the number of
transactions.
So, as I have never used the rankx function before, I can I make sure that the top 10 list will be good considering the
applied filters.
Does someone could give me an example of the proper use of the rankx function with let's say the use of two filters
the region, and business line based on the number of transactions.
Thank you in advance for your help
alepage
@Anonymous
Your interpretation of HASONEVALUE is slightly off. In fact, it is asking if the field has one value. My salesperson table has one value at the employee name but, as an example, multiple names in the region. Therefore, it would work as long as the employee name is the top in any of your drill downs or filters. In other words, if you put region above the rep name, the rank would be incorrect for the region. That doesn't mean that you cannot write the calculation to account for multiple levels, you can, but it would be irrelevant for this question. Your other slicers and filters would be respected withint the count of transactions calculation you would need.
You would need something along the lines of:
Rank = IF(
ISFILTERED('RepTable'[Name]),
RANKX(
ALLSelected ('RepTable'[Name]),
[Count of Transactions], , DESC, Dense
)
)
This would rank the reps by name using a measure called Count of Transactions (you would need to define and create), in descending order, populating the rank in a dense fashion to use as many numbers as possible. Don't skip the comma space comma!
Proud to be a Super User!
Thanks a lot for your anwser.
Here's the script I am testing and it seems to work well. Feel free to make any comment or warning. As I have mentioned , it is the first time I am using the rankx function.
The amout is in a fact table which is affected by the slicer. So, I am using the measure below
User | Count |
---|---|
66 | |
60 | |
47 | |
33 | |
32 |
User | Count |
---|---|
86 | |
75 | |
56 | |
50 | |
45 |