Forum Discussion

nj-matt's avatar
nj-matt
Icon for Helper I rankHelper I
3 years ago
Solved

Help with PREVIOUSDAY and weekends

I have a dataset that is updated each workday - trying to use the PREVIOUSDAY dax formuls that works like a charm, but I have an issue with non consecutive days.   Example -    Date Day of We...
  • Samarth_18's avatar
    3 years ago

    Hi nj-matt ,

     

    You can create a measure as below:-

    _Measure =
    VAR _current_date =
        MAX ( 'Table (3)'[Date] )
    VAR _prev_date =
        CALCULATE (
            LASTDATE ( 'Table (3)'[Date] ),
            FILTER ( ALL ( 'Table (3)' ), 'Table (3)'[Date] < _current_date )
        )
    RETURN
        CALCULATE (
            MAX ( 'Table (3)'[Sales] ),
            FILTER ( ALL ( 'Table (3)' ), 'Table (3)'[Date] = _prev_date )
        )