Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Retrieve Last Date a Value Changed by Group

Hi everyone,   I've been troubleshooting this issue for a couple hours now to no avail. Let's say I have the following dataset: Group Date Setting A 1/30/23 5.3 A 1/15/23 5.3 A ...
  • FreemanZ's avatar
    3 years ago

    hi Anonymous 

    try like:

    NewColumn =
    VAR _group = [Group]
    VAR _grouptable = 
    FILTER(
         TableName, 
         TableName[Group] = _group
    )
    VAR _lastdate =
    MAXX(
        _grouptable,
       TableName[Date]  
    )
    VAR _lastsetting =
    MAXX(
        FILTER(
             _grouptable,
             TableName[Date]=_lastdate
        ),
       TableName[Setting]  
    )
    RETURN
    MINX(
        FILTER(
             _grouptable,
             TableName[Setting] = _lastsetting
        ),
        TableName[Date]
    )