Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
cham
Post Patron
Post Patron

TOP N not working

Hi,

I want to get the TOP 5 driver numbers according to the amount. I tried it as below but its not working. Can anyone help me to do this? 

 

TOP N.PNG

 

 

1 ACCEPTED SOLUTION

Hello @cham 

I believe I did find a way to solve this.  I had to add a drivers table to use as a anchor for the rankings.

TopNDrivers.jpg

The udpated file is attached.

View solution in original post

21 REPLIES 21
Ashish_Mathur
Super User
Super User

Hi,

Try these measures

Total value = SUM(Table[Amount])

Rank by Driver = RANKX(ALL(Table[Driver]),[Total value])

Drag Driver and Total value measure to your visual.  Filter the second measure on Less than equal to 5.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi,

 

What you mean by Filter the second measure on Less than equal to 5? 

 

See the below pic. Cannt we use TOP N filter to do this?

 

Top N ex..PNG

Yes, The TopN should also work.  Try it.  If it does not, then share the link from where i can download your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur 

 

I tried TOP N but its not working that's why I asked it from community. 

 

I used below two column in my report ,

Driver NoAmount
129876
142345
131234
124456
123221
121111
1523345
153456
1222224
121234
162214
161111
163345

 

Hi,

It works fine for me.  See the screenshot.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur ,

 

I have a Driver No field with another measure I want to get top 5 drivers according to that measure. How can I get that?

Hi @Ashish_Mathur 

 

Please download the below file and check. I creted a table and created to N but its not working. Its showing more than 20 Driver Numbers

 

https://drive.google.com/file/d/1zkH2F7ZLosCyORMGP6jfRbsI5-aapeVG/view?usp=sharing

You could take into account the number of responses along with the avg score to get a ranking.  I have added the calc and adjusted the matrix to give you an idea of what I had in mind.

TopNDrivers.jpg

Hey @jdbuchanan71 ,

smart move!



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Hi @jdbuchanan71 ,

 

Can you please explain me the measure you used for calculate the ranking?

Sure

If [Dirver Number] = 0 or [Driver Number] = BLANK() ignore the row in the ranking.

Otherwise rank the drivers based on [Avg Score] * [Response Count].

Basically, if two drivers have the same average score rank the one with more responses higher.

Hi @jdbuchanan71 

 

Cant we put rank the drivers based on [N]? 

 

Also if I add the coutry into it numbers are getting increase. Why is that? 

@cham 

You can apply a filter to a visual of TopN based on a measure.  For ranking you want to do it in BottomN so it will go from lowets (1, which is the best rank) up.


Not sure what you mean about country, can you share your data including the country and show the problem and expected result?

Hi @jdbuchanan71 ,

 

https://drive.google.com/file/d/10a5XQYojfl9c-4unh1ZBbmDNs9E2ekh5/view?usp=sharing

 

Please find the above link to access the file. I want to show Top 20 "N" value accoding to the drive and the country. 

 

I am confusing why you create a response count aand ave score for this? I want to get top 20 drivers in countries which show top 20 "N values"

 

Hope this explain you my question. 

@cham 

There are 25 drivers in Canada all with N = 100.  Which 20 of those do you want?

topn20.jpg

Hi @jdbuchanan71 

 

Did you find any way to solve this? Can you please help me with this?

Hello @cham 

I believe I did find a way to solve this.  I had to add a drivers table to use as a anchor for the rankings.

TopNDrivers.jpg

The udpated file is attached.

Hi @jdbuchanan71 

 

Thank you so much for your help. Appreciate it 🙂

Hi @jdbuchanan71 

 

I have added a resposes field that now you can filter it. Please check the updated file.

Hi,

The value of N for more than 20 drivers is the same.  Perhaps this is the reason for the TopN not working.  Considering more then 20 drivers have the same value of N i.e. 100, what result do you expect to see?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.