Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago

Dynamic Rolling Sum - 4 Quarters Trailing

Hi,

 

I have a requirement to compute rolling sum for the trailing quarters with a dynamic range from Current Quarter till the Last 4 Quarters. 
For an example, if the Current Fiscal Quarter is '2018-Q2' then the Revenue value should be the sum of "2017-Q3 to 2018-Q2"(as shown in the screenshot).

 

 

Any thoughts to achieve this.

5 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi v-chuncz-msft

      The calculation in the above link is not satisfying my requirement. When I use this calculation it is giving me only Q4 of all the years and the numbers are wrong.

       

      My requirement is to get last 3 quarters + Current quarter for every quarter.
      (Example: If we are in 2018-Q2, it should give me {2018-Q2 + 2018-Q1 + 2017-Q4 + 2017-Q3} )

       

      Trailing Quarters Sum=

      VAR S = Table[Segment]

      VAR Q = Table[QuarterNumber]

      RETURN

          IF (

              Q >= 4,

              SUMX (

                  FILTER (

                      Table,

                      Table[Segment] = S

                          && Table[QuarterNumber]

                          > Q - 4

                          && Table[QuarterNumber] <= Q

                  ),

                  Table[Total_Revenue]

              )

          )

      * QuarterNumber = ROUNDUP(MONTH(Table[Date])/3,0)