Forum Discussion

nielfxrm's avatar
nielfxrm
Frequent Visitor
7 years ago
Solved

Cumulative sum with multiple filters

Hi,

 

I have created a running total DAX formula as below:

 

RunningTotal = 

CALCULATE( 
    SUM( Opportunity[Sales Price (DKK)] );
    FILTER( 
        ALLSELECTED( Opportunity );
        Opportunity[Close Date] <= MAX( Opportunity[Close Date] )
    )
)

That formula works. However, I would like to add the filter below as well - but I can't seem to get that working:

 Opportunity[Pipeline Category] = "Won" 

Any input is appreciated. 

 

  • nielfxrm Please try changing the SUM function inside the CALCULATE as below:

     

    SUMX(FILTER(Opportunity,  Opportunity[Pipeline Category] = "Won"), Opportunity[Sales Price (DKK)])

3 Replies

  • PattemManohar's avatar
    PattemManohar
    Icon for Community Champion rankCommunity Champion

    nielfxrm Please try changing the SUM function inside the CALCULATE as below:

     

    SUMX(FILTER(Opportunity,  Opportunity[Pipeline Category] = "Won"), Opportunity[Sales Price (DKK)])
    • nielfxrm's avatar
      nielfxrm
      Frequent Visitor

      Thanks PattemManohar. That did the job. 

       

      I was trying to add the filter somewhere else in the formula.

       

      Cheers. 

  • I tried to following  this  method but get an error

     

     

    T1B Cumulative Total =
    CALCULATE (
        SUMX(FILTER('VO Register (2)','VO Register (2)'[04 Goal]="Improve Downside (45Q)"),Timeline[T1.Mid Cu.EPV(m$)]);
               FILTER(
                ALLSELECTED('Timeline'[D. Progress to Implement Gate 3]),
                'Timeline'[D. Progress to Implement Gate 3]<= max(Timeline[D. Progress to Implement Gate 3]
            ))
     

    If i remove the " ;" then it tells me the Fileter argument is incorrect