Forum Discussion

MrMP's avatar
MrMP
Helper III
2 years ago
Solved

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, prod...
  • Anonymous's avatar
    Anonymous
    2 years ago

    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