Forum Discussion

vkisa's avatar
vkisa
Icon for Helper II rankHelper II
1 year ago
Solved

Partly Cumulative Sum Measure in Matrix

Hi, 

I need some help to calculate cumulative sum in matrix.

I have income matrix by date1 and date2 columns as below. 

                                          Date2Month        

Date1YearDate1MonthFebruaryMarchAprilMayJune
2024February61-23867013
2024March 8170455
2024April  915942
2024May   9978
2024June    170

 

And, there is also total cost by date1 as below,

Date2Month Cost

February632
March83
April128
May181
June217

 

The matrix I want to reach out is as below.

 

                                          Date2Month        

Date1YearDate1MonthFebruaryMarchAprilMayJune
2024February-571-594-508-438-424
2024March -268113148
2024April  -372264
2024May   -82-4
2024June    -47

 

And the calculation of aim matrix;

1- Income- Cost for diagonal cells (Feb-Feb, March-March,...)

2- For next months the calculation should be aggregated sum.

 

Here is how the matrix should be calculated as,

 

                                           Date2Month        

Date1YearDate1MonthFebruaryMarchAprilMayJune
2024February"61-632=-571""-571-23""-594+86""-508+70""-438+13"
2024March "81-83""-2+70""68+45""113+35"
2024April  "91-128""-37+59""22+42"
2024May   "99-181""-82+78"
2024June    "170-217"

 

I can upload a sample pbix file if you need. Thank you for your helping.

 

Regards,

Veli

 

  • This is one of the rare cases where a bidirectional relationship makes some sense.

     

     

    I assumed your data is in a much better shape, like this

     

     

     

2 Replies

  • This is one of the rare cases where a bidirectional relationship makes some sense.

     

     

    I assumed your data is in a much better shape, like this