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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
MrMP
Helper III
Helper III

Product ranking

Hi,

 

Is there a way when user selects one product in upper chart for line chart below to plot him what was product rank for each day?

For example, if total of 10 products were sold that day, product was on 2nd place ---> 2/10

 

MrMP_4-1713430815218.png

Dataset is quite simple. Date | Product | Sales

 

Thank you!

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @MrMP 

First, thanks for @amitchandak  help. If you have not solve the problem, you can try the following method.

vyaningymsft_0-1713492062993.pngvyaningymsft_1-1713492090393.png

DAX:

Rank = 
RANKX (
    FILTER (
        'Table',
        'Table'[Date] = EARLIER ( 'Table'[Date] )
    ),
    'Table'[Sales],
    ,
    DESC,
    Dense
)
MaxRank = 
VAR _maxRank = CALCULATE(MAX('Table'[Rank]))
RETURN
_maxRank

RANK BY Product =
IF (
    CALCULATE ( SUM ( 'Table'[Rank] ) ) > [MaxRank],
    "Please select one Product",
    [MaxRank]
)

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

Not sure of what result you want.  Share data in a format that can be pasted in an MS Excel file.  Show the expected result clearly.


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

Hi, @MrMP 

First, thanks for @amitchandak  help. If you have not solve the problem, you can try the following method.

vyaningymsft_0-1713492062993.pngvyaningymsft_1-1713492090393.png

DAX:

Rank = 
RANKX (
    FILTER (
        'Table',
        'Table'[Date] = EARLIER ( 'Table'[Date] )
    ),
    'Table'[Sales],
    ,
    DESC,
    Dense
)
MaxRank = 
VAR _maxRank = CALCULATE(MAX('Table'[Rank]))
RETURN
_maxRank

RANK BY Product =
IF (
    CALCULATE ( SUM ( 'Table'[Rank] ) ) > [MaxRank],
    "Please select one Product",
    [MaxRank]
)

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

amitchandak
Super User
Super User

@MrMP , if you create a rank measure it will get distributed based on date in second visual and will give date of filtered product 

 

rankx(allselected(Table[Product]), [Sales measure])

 

or new rank function

 

rank(DENSE,ALLSELECTED(Table[Product], Table[Date]),ORDERBY([Sales],DESC),, partitionBy(Table[Date]) )

 

Power BI - New DAX Function: RANK - How It Differs from RANKX: https://youtu.be/TjGkF44VtDo

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you for help. Bottom chart should be trend over time. With that measure, it gives rank 1 for every calendar date when I select product.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.