Forum Discussion

aparodi's avatar
aparodi
Frequent Visitor
10 years ago
Solved

DAX - How calculate a Running Total 2 from previous Running Total 1

Hi,

 

I need create a measure (Running Tot2) that calculates running total based on an earlier measure  that calculates the a previous running total (Running Tot1)

 

PM Sales := sum(Sales[Current Sales])
Running Tot1 = CALCULATE([PM Sales],FILTER(ALLSELECTED(DimTime[Date]),DimTime[Date] <= MAX(DimTime[Date])))
Running Tot2 = CALCULATE([Running Tot1],FILTER(ALLSELECTED(DimTime[Date]),DimTime[Date]<= max(DimTime[Date])))

 

Regards

 

2015-11-20_13-24-40.png

 

2015-11-20_13-22-52.png

  • After various tests, I found a solution. :smileyvery-happy:

     

    Running Tot2 = SUMX(FILTER(ALLSELECTED(DimTime[Date]),DimTime[Date] <= MAX((DimTime[Date]))),[Running Tot1])

     

    2015-11-24_12-03-55.png

5 Replies

  • You didn't say what you're expecting to see. I imagine you want [running tot2] to be a date behind [running tot1]. In other words, 2/3 would be blank, 2/10 would be 4, 2/17 would be 8 and 2/24 would be 12. Is that right?

     

    • aparodi's avatar
      aparodi
      Frequent Visitor

      Hi Leonard

       

      In [running tot2] i expecting:

       

      2/3        4

      2/10     12

      2/17      24

      2/24      37

       

       

      • aparodi's avatar
        aparodi
        Frequent Visitor

        After various tests, I found a solution. :smileyvery-happy:

         

        Running Tot2 = SUMX(FILTER(ALLSELECTED(DimTime[Date]),DimTime[Date] <= MAX((DimTime[Date]))),[Running Tot1])

         

        2015-11-24_12-03-55.png