Forum Discussion

Fangyi8's avatar
Fangyi8
Frequent Visitor
3 years ago
Solved

Previous day/date values

Hi guys, please i need help. I am trying to calculate the daily growth rate and I used this formula to get what I have in the "previous" column:  previous = CALCULATE( [current], PREVIOUSDAY('publ...
  • Jihwan_Kim's avatar
    3 years ago

    Hi,

    In case there is no calendar table, please try like the below and the attached pbix file.

     

     

    Previous measure: = 
    VAR _prevdate =
        MAXX (
            FILTER (
                ALL ( 'public sales_reports'[sale_dt] ),
                'public sales_reports'[sale_dt] < MAX ( 'public sales_reports'[sale_dt] )
            ),
            'public sales_reports'[sale_dt]
        )
    RETURN
        IF (
            HASONEVALUE ( 'public sales_reports'[sale_dt] ),
            CALCULATE ( [current measure:], 'public sales_reports'[sale_dt] = _prevdate )
        )