Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Create Rank column based on grouping and order by another column

I need to create a calculated column which will contain a rank value but this will be based on multiple columns: The sample data is as below : I need to create a Rank column and its shoulbe grouped b...
  • MFelix's avatar
    6 years ago

    Hi Anonymous ,

     

    Create the following calculated column to your table:

     

    Rankin =
    RANKX (
        FILTER ( 'Table'; 'Table'[statement_id] = EARLIER ( 'Table'[statement_id] ) );
        'Table'[line_id];
        ;
        DESC;
        DENSE
    )

     

  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi Anonymous ,

     

    incase you wan to create a Calculated COlumn

     

     

     

    RANKing Group = RANKX(FILTER('Table','Table'[statement_id] = EARLIER('Table'[statement_id])),'Table'[line_id],,DESC,DENSE)

     

     

     

     

     

    Incase you want to create a measure

     

     

     

    RANKing OrderId = RANKX(FILTER(ALL('Table'[statement_id],'Table'[line_id]), 'Table'[statement_id] = MAX('Table'[statement_id])),CALCULATE(SUM('Table'[line_id])))

     

     

     

     

     

     


    Regards,

    Harsh Nathani


    Appreciate with a Kudos!! (Click the Thumbs Up Button)

    Did I answer your question? Mark my post as a solution!