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
CarolineSH
Frequent Visitor

Get top 3 product based on price

I want to group on the accountID and sort the products price and get out top three.

 

This is the table with example data:

AccountID          Order                   OrderProducts                   Price

1234                     XYZ                       Chair small                         200

1234                     XYZ                       Sofa                                   5000

1234                     XYZ                       Bench                                 600

1234                     XYZ                       Shelf                                  1200

1234                     XYZ                       Table                                  2300     

1234                     XYZ                       Chair medium                   300       

2233                     ABC                      Curtain                               75

2233                     ABC                      Pillow                                 80                                       

2233                     ABC                      Pillowcase                         30

2233                     ABC                      Tablecloth                         40

2233                     ABC                      Rug                                   150

 

When I choose accountID to add in my visual, I want to get the top three priced products for that account.

Example in matrix:

AccountID

Order

 

Price

1234

XYZ

 

 

    Sofa

    Table

    Shelf

 

 

5000

2300

1200

2233

ABC

 

 

    Rug

    Pillow

    Curtain

 

 

150

80

75

 

How can I do this?

 

2 ACCEPTED SOLUTIONS
Gordonlilj
Solution Sage
Solution Sage
dax
Community Support
Community Support

Hi CarolineSH,

You could try below measure to see whether it work or not

Measure =
RANKX (
    ALLEXCEPT ( 'Table (2)', 'Table (2)'[AccountID], 'Table (2)'[Order] ),
    CALCULATE ( SUM ( 'Table (2)'[Price] ) ),
    ,
    DESC,
    DENSE
)

506.PNG

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
dax
Community Support
Community Support

Hi CarolineSH,

You could try below measure to see whether it work or not

Measure =
RANKX (
    ALLEXCEPT ( 'Table (2)', 'Table (2)'[AccountID], 'Table (2)'[Order] ),
    CALCULATE ( SUM ( 'Table (2)'[Price] ) ),
    ,
    DESC,
    DENSE
)

506.PNG

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Gordonlilj
Solution Sage
Solution Sage

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.