Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Ranking by Date with Grouping

Hello All,   I am new to PowerBI and have looked at a lot of articles similar to this, but have yet to find a solution that works for me.   I have a table that has purchase order numbers with the...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Anonymous ,

    Please try below steps:

    1. below is my test table

    Table:

    2. create a measure with below dax formula

    Measure =
    VAR cur_po =
        SELECTEDVALUE ( 'Table'[PO #] )
    VAR cur_item_code =
        SELECTEDVALUE ( 'Table'[Item Code] )
    VAR tmp =
        FILTER (
            ALL ( 'Table' ),
            'Table'[Item Code] = cur_item_code
                && 'Table'[PO #] = cur_po
        )
    RETURN
        RANKX ( tmp, CALCULATE ( SELECTEDVALUE ( 'Table'[PO Date] ) ),, DESC, DENSE )
    

    3. add a  table visual with fields and measure

    Please refer the attached .pbix file.

     

    Best regards,
    Community Support Team_Binbin Yu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.