Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago
Solved

Running Total - DAX

Hi all,

 

I have an issue calculating running totals.

We use a matching chance metric to calculate a forecast. 

 

 

Matching chance Job level = SUMX(VALUES(Table[column1]) ; CALCULATE(MAX(Table[column2])))

 

 

Now we want to calculate running totals on the level of account and date (year/month). And we made this DAX formula:

 

 

Running Total = CALCULATE(SUM(Table1[columnA]); FILTER(ALL(Table1); Table1[Date] <= MAX(Table1[Date])); VALUES(Table2[columnA]); VALUES(Table1[columnB]))

 

 

YearMonthMatching chance Job levelRunning Total
2016October11,00
2016November1,42,00
2016December0,41,90
2017January13,00
2017February0,53,10
 TOTAL4,404,40

 

 

Any ideas would be much appericated.  Thanks for any and all help in advance!

 

  • Running Total = CALCULATE(SUM(Table1[columnA]); FILTER(ALL(Table1); Table1[Date] <= MAX(Table1[Date])),FILTER(ALLSELECTED(Table2[columnA]),Table2[columnA]=Table2[columnA]),FILTER(ALLSELECTED(Table1[columnB]),Table1[columnB]=Table1[columnB]))


    Then try this way in order to make filter works

4 Replies

  • Formula Looks good not sure if VALUES are helping out in this case. Try remove those and see if you are able to do calculations as desired.

     

    Running Total = CALCULATE(SUM(Table1[columnA]); FILTER(ALL(Table1); Table1[Date] <= MAX(Table1[Date])))
    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks for your response FarhanAhmed1984. I think I need to include the VALUES because I want to filter my visual based on Account (name) and Position (status). Or do you see another option?

      • FarhanAhmed1984's avatar
        FarhanAhmed1984
        Resolver III
        Running Total = CALCULATE(SUM(Table1[columnA]); FILTER(ALL(Table1); Table1[Date] <= MAX(Table1[Date])),FILTER(ALLSELECTED(Table2[columnA]),Table2[columnA]=Table2[columnA]),FILTER(ALLSELECTED(Table1[columnB]),Table1[columnB]=Table1[columnB]))


        Then try this way in order to make filter works