Forum Discussion

Diptarup's avatar
Diptarup
Icon for Helper II rankHelper II
5 years ago
Solved

To get top 5 lowest value based on recent activity

I wanted to get the top 5 lowest value based on the most recent activity perform. Lets take an example, in the below table, I have activity starting from A to J. Based on the recent activity Top 5 Lo...
  • v-easonf-msft's avatar
    v-easonf-msft
    5 years ago

    Hi, Diptarup 

    For your requirement, you can try to ceate a calculated table as below:

    Table 2 =
    VAR tab =
        SUMMARIZE (
            'Table',
            'Table'[Activity],
            "Year", CALCULATE ( MAX ( 'Table'[Year] ), ALLEXCEPT ( 'Table', 'Table'[Activity] ) ),
            "Value",
                CALCULATE (
                    MAX ( 'Table'[Value] ),
                    FILTER (
                        'Table',
                        'Table'[Year]
                            = CALCULATE ( MAX ( 'Table'[Year] ), ALLEXCEPT ( 'Table', 'Table'[Activity] ) )
                    )
                )
        )
    VAR tab2 =
        ADDCOLUMNS ( tab, "Rank", RANKX ( tab, [Value],, ASC, SKIP ) )
    RETURN
        FILTER ( tab2, [Rank] <= 5 )
    //return TOPN(5,tab,[Value],DESC)
    

    Best Regards,
    Community Support Team _ Eason
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.