Forum Discussion

bininja's avatar
bininja
Icon for Helper I rankHelper I
7 years ago
Solved

Pick first value for each id based on date

Hi guys,   I am struggling to pick up the first value registered for a id based on the earliest date. So for the customer below, a membership is first created on 01.01.2016 and the first activity ...
  • v-juanli-msft's avatar
    7 years ago

    Hi bininja 

    Create measures

    Measure = DATEDIFF(MAX('Table'[created date]),MAX('Table'[activity date]),DAY)
    
    Measure 2 =
    RANKX (
        FILTER (
            ALL ( 'Table' ),
            'Table'[id] = MAX ( 'Table'[id] )
                && 'Table'[created date] = MAX ( 'Table'[created date] )
        ),
        [Measure],
        ,
        ASC,
        DENSE
    )
    
     
    Best Regards
    Maggie
    Community Support Team _ Maggie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.