Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Previous day cost...

Hey there...

 

I'm looking for a dax measure that brings me the sum of my costs of the previous day in relation with the current day, and also that changes according to the day. 

 

Thanks in advanced

 

 

  • mwegener's avatar
    mwegener
    6 years ago

    Okay, than use this part...

    PREV_DAY = CALCULATE(SUM('Table'[Value]); DATEADD('Date'[Date]; -1; DAY))

    ... and filter the date on today (relative date filter)

  • mwegener's avatar
    mwegener
    6 years ago
    Yesterday = CALCULATE(SUM('Table'[Value]), 'Date'[Date] = TODAY()-1)

5 Replies

  • mwegener's avatar
    mwegener
    Icon for Most Valuable Professional rankMost Valuable Professional

    Hi Anonymous 

     

    look at this

     

     

    Value DoD% = 
    VAR __PREV_DAY = CALCULATE(SUM('Table'[Value]); DATEADD('Date'[Date]; -1; DAY))
    RETURN
    	DIVIDE(SUM('Table'[Value]) - __PREV_DAY; __PREV_DAY)

     

     

    If I answered your question, please mark my post as solution, this will also help others.

    Please give Kudos for support.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you but i'm not looking a % numer, I just want to calculate the sum of my cost of yesterday day.

      • mwegener's avatar
        mwegener
        Icon for Most Valuable Professional rankMost Valuable Professional

        Okay, than use this part...

        PREV_DAY = CALCULATE(SUM('Table'[Value]); DATEADD('Date'[Date]; -1; DAY))

        ... and filter the date on today (relative date filter)