+ Reply to Thread
Results 1 to 8 of 8

Power BI - Display Top 3 by Rank

  1. #1
    Registered User
    Join Date
    03-08-2020
    Location
    UK
    MS-Off Ver
    365 Business & 365 Family
    Posts
    34

    Power BI - Display Top 3 by Rank

    Hi,

    I've attached an example of my data and project of what im trying to do but for some reason i cant get it to work correctly. No doubt I'm probably doing this wrong so any help and advice would be much appreciated.

    I'm trying to list the top 3 customers that have ordered the most (by revenue) to be displayed in a table but its not working the way I thought it would.

    As you can see from the project I've created 2 calculated columns, one to calculate the total revenue from all the orders they've placed and another to rank the customers by most revenue using the below DAX:

    Calculate total revenue from all orders by the same customer:

    Please Login or Register  to view this content.
    Rank Customer by most revenue from their orders:

    Please Login or Register  to view this content.
    When looking at the data the new columns are working as expected. But the issue i have is showing the data in a table, as you can see from the image below its showing rank 1, 2 and 4. How come its now showing the 3rd biggest customer and instead showing the 4th biggest?

    powerbi-test.PNG

    Also is there a simpler way to do what I'm after?

    Any help and advice would be much appreciated and thank you.
    Attached Files Attached Files
    Last edited by micky007; 01-16-2021 at 11:37 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,906

    Re: Power BI - Display Top 3 by Rank

    Baffling! I can't see any obvious mistakes in the .pbix file.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    03-08-2020
    Location
    UK
    MS-Off Ver
    365 Business & 365 Family
    Posts
    34

    Re: Power BI - Display Top 3 by Rank

    Thanks for taking a look into it Ali. I know right! I thought it would work fine but I have no idea why this is happening. Hopefully someone can see an issue and help me resolve the problem.

    Thank you though

  4. #4
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Power BI - Display Top 3 by Rank

    Don't use calculated columns for summarizing value.
    Use Measure
    Rev = sum('GB Product Orders'[Total Amount])

    RankRev = RANKX(ALL('GB Product Orders'[Account: Account Name]),[Rev])

    Then filter rank less or equal than 3
    Attached Files Attached Files

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,906

    Re: Power BI - Display Top 3 by Rank

    Here's another way. I created a query to calculate grouped totals, and then used this for the visual.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    03-08-2020
    Location
    UK
    MS-Off Ver
    365 Business & 365 Family
    Posts
    34

    Re: Power BI - Display Top 3 by Rank

    Thank you very much both of you!

    Two great examples which I've looked at both and fully understand what you've done.

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,906

    Re: Power BI - Display Top 3 by Rank

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  8. #8
    Registered User
    Join Date
    03-08-2020
    Location
    UK
    MS-Off Ver
    365 Business & 365 Family
    Posts
    34

    Re: Power BI - Display Top 3 by Rank

    Already done both of those haha

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Sub-Forum for Excel Power Tools (Power Query, Power Pivot & Power BI)
    By chullan88 in forum Suggestions for Improvement
    Replies: 10
    Last Post: 06-28-2018, 02:25 PM
  2. Replies: 0
    Last Post: 12-04-2015, 11:31 AM
  3. [SOLVED] RANK.EQ Function in Power Pivot Measure
    By rv02 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 03-16-2015, 04:26 PM
  4. Power Pivot rank cells if condition on column is met.
    By hyperlemon in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-18-2014, 04:39 AM
  5. [SOLVED] Display rank in chart
    By NJ007 in forum Excel Charting & Pivots
    Replies: 10
    Last Post: 05-20-2013, 11:40 PM
  6. Edit V B A Code For Display Power
    By abbccc in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-23-2013, 05:47 AM
  7. how to display 1st, 2nd, 3rd referring to rank
    By vlady in forum Excel General
    Replies: 7
    Last Post: 10-02-2011, 10:14 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1