Forum Discussion

Dimitris_Kats's avatar
2 years ago
Solved

Reversed rolling total

Hello dear members.

 

I have a problem and I need your help.

I have a measure that calculates a percentage for January, February, March, April and May. May 2023 is my max month year.

I want for January the sum of this measure for January until my max month ( May 2023). For February I want the sum of January until April (max month -1), for March I want the sum of January until March, for April I want the sum of January and February and for May the value of January.

 

This is a simple example

My percentages are

January 8%

February 6%

March 3%

April 2%

May 1%

I need a measure to calculate the following

January (8%+6%+3%+2%+1%) =20%

February (8%+6%+3%+2%)=19%

March (8%+6%+3%)=17% 

And so on. 

Can you think any solution?? 

  • Hi.

    I have found a solution. It was easier than I thought.

    I filtered me date table and the logic behind my calculations is as follows:

    time[date]>= January && time[date] <= max month - current month+1 😊😊

3 Replies

    • Dimitris_Kats's avatar
      Dimitris_Kats
      Helper V

      Hi. Thank you very much for your reply.

      First of all I have a date table linked to my fact table.

      My matrix looks like this:

      Month Year % desired measure

      January 23 8% 20%

      February 23 6% 19%

      March 23 3% 17%

      April 23 2% 14%

      May 23 1% 8%

       

      Thank you very much in advance 

  • Hi.

    I have found a solution. It was easier than I thought.

    I filtered me date table and the logic behind my calculations is as follows:

    time[date]>= January && time[date] <= max month - current month+1 😊😊