Forum Discussion

ldmass's avatar
ldmass
Regular Visitor
3 years ago
Solved

Get last sequences for a value

Hi Experts, I'm having trouble solving an issue that seems simple but I can't find the solution. I have a table where I have the following columns:   Sinister Sequence Date Patient Episode ...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi  ldmass ,

    Here are the steps you can follow:

    1. Create calculated table.

    Date =
    CALENDAR( DATE(2022,1,1),DATE(2022,12,31))

    2. Create measure.

    Flag =
    var _mindate=MINX(ALLSELECTED('Date'),[Date])
    var _maxdate=MAXX(ALLSELECTED('Date'),[Date])
    var _max=
    MAXX(FILTER(ALLSELECTED('Table'),
    'Table'[Date]>=_mindate&&'Table'[Date]<=_maxdate&&'Table'[Sinister]=MAX('Table'[Sinister])),[Sequence])
    return
    IF(
        MAX('Table'[Sequence])=_max,1,0)

    3. Place [Flag]in Filters, set is=1, apply filter.

    4. Result:

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly