Forum Discussion

thinker_02's avatar
thinker_02
Regular Visitor
2 years ago
Solved

Previous Status Measure

The "Profit" table has columns Product ID, Date, and Status, with Status categorized as High, Low, or Medium. Snapshot of the Profit table: | Product ID | Date | Status | |------------|-------...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi thinker_02  ,

     

     

    Here are the steps you can follow:

    1. Create measure.

    Flag =
    var _date=
    MAXX(
       FILTER(ALLSELECTED('Table'),'Table'[Product ID]=MAX('Table'[Product ID])),[Date])
    return
    IF(
        MAX('Table'[Date])=_date,1,0)
    Second Date =
     var _date=
    MAXX(
        FILTER(ALLSELECTED('Table'),'Table'[Product ID]=MAX('Table'[Product ID])),[Date])
    return
    MAXX(
        FILTER(ALL('Table'),
        'Table'[Product ID]=MAX('Table'[Product ID])&&'Table'[Date]<_date),[Date])
    Status Latest =
    var _date=
    MAXX(
        FILTER(ALLSELECTED('Table'),'Table'[Product ID]=MAX('Table'[Product ID])),[Date])
    var _maxdate=
    MAXX(
        FILTER(ALL('Table'),
        'Table'[Product ID]=MAX('Table'[Product ID])&&'Table'[Date]<_date),[Date])
    return
    MAXX(
        FILTER(ALL('Table'),
       'Table'[Product ID]=MAX('Table'[Product ID])&& 'Table'[Date] =_maxdate),[Status])

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

    3. 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