Forum Discussion

sayali_deshmukh's avatar
sayali_deshmukh
Helper III
6 years ago
Solved

Calculated Column for previous date values

Hi,

Have a table as per below - 

Need help for calculating yesterday's actual and day before yesterday's actual using DAX.

  • sayali_deshmukh 

    You can create measure like with date calendar

    Day behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Day))

    2 Day behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-2,Day))

  • v-deddai1-msft's avatar
    v-deddai1-msft
    6 years ago

    Hi sayali_deshmukh,

     

    Would you please refer to the following calculated column:

    Yesterday's Update = CALCULATE(MAX('Table'[Today's Update]),ALL('Table'),'Table'[Task] = EARLIER('Table'[Task]),'Table'[Date] = EARLIER('Table'[Date])-1)
    
    
    
    Day Before Yesterday's Update = CALCULATE(MAX('Table'[Today's Update]),ALL('Table'),'Table'[Task] = EARLIER('Table'[Task]),'Table'[Date] = EARLIER('Table'[Date])-2)
    

    Best Regards,

    Dedmon Dai

6 Replies

  • sayali_deshmukh 

    You can create measure like with date calendar

    Day behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Day))

    2 Day behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-2,Day))

      • amitchandak's avatar
        amitchandak
        Super User

        For that prefer to have column like this

        maxx(filter(table,table[task]=earlier(table[task]) && table[Date]=earlier(table[Date])-1),[Todays Plan])

         

        Or try the same formula(provided in last update) with Max function and text column