Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more
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
Dataset is quite simple. Date | Product | Sales
Thank you!
Solved! Go to Solution.
Hi, @MrMP
First, thanks for @amitchandak help. If you have not solve the problem, you can try the following method.
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
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.
Hi, @MrMP
First, thanks for @amitchandak help. If you have not solve the problem, you can try the following method.
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
@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
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.