Forum Discussion

PowerUser123's avatar
PowerUser123
Icon for Helper II rankHelper II
4 years ago
Solved

Cumulative Sum - Adjusted Value Each Day

So I created a measure called Win Loss which is just the sum of sales - 250,000 which can be seen in the 2nd column below. I wanted to create a running total of this win loss, but I don't think the measure is calculating correctly. It looks like it's taking the first day's sales less 250k, but then just adding total sales to that amount thereafter. What am I doing wrong?

 

Win Loss Run = CALCULATE([Win Loss],FILTER(ALLSELECTED('Calendar'[Date]),'Calendar'[Date]<=MAX('Calendar'[Date])))

 

 

  • PowerUser123 , Try like

     

    Win Loss Run = CALCULATE(sumx(values('Calendar'[Date]),[Win Loss]),FILTER(ALLSELECTED('Calendar'[Date]),'Calendar'[Date]<=MAX('Calendar'[Date])))

  • Hi PowerUser123 ,

     

    Try this.

     

    Running Total =
    VarLastDate =LASTDATE('Date Table'[DateKey])
    return CALCULATE(sum('Table'[Value]),ALLEXCEPT('Date Table','Date Table'[DateKey]),'Date Table'[DateKey]<=VarLastDate)

3 Replies

  • PowerUser123 , Try like

     

    Win Loss Run = CALCULATE(sumx(values('Calendar'[Date]),[Win Loss]),FILTER(ALLSELECTED('Calendar'[Date]),'Calendar'[Date]<=MAX('Calendar'[Date])))

  • davehus's avatar
    davehus
    Icon for Memorable Member rankMemorable Member

    Hi PowerUser123 ,

     

    Try this.

     

    Running Total =
    VarLastDate =LASTDATE('Date Table'[DateKey])
    return CALCULATE(sum('Table'[Value]),ALLEXCEPT('Date Table','Date Table'[DateKey]),'Date Table'[DateKey]<=VarLastDate)