Forum Discussion
Diagonal Matrix and Cumulative Sum with Measures
- Anonymous1 year ago
Hi vkisa ,
I modified two measures you provided and created a new one:
New_Profit = var year1=SELECTEDVALUE(Date1[Year]) var year2=SELECTEDVALUE(Date2[Year]) VAR selectedmonth=MAX(Months[MonthNum]) var date1=SELECTEDVALUE(Months[MonthNum]) var date2=SELECTEDVALUE(Date2[MonthNumber]) RETURN CALCULATE( SUM(Data[Profit]), FILTER(Data, Data[Year1]=2024 && Data[Month1]<=date1) )New_Profit_agg = VAR selectedmonth=MAX(Months[MonthNum]) RETURN DIVIDE([New_Profit],[FTB_Count],0)Measure = IF(MAX('Date2'[MonthNumber])<=MAX('Months'[MonthNum]),[New_Profit_agg]-CALCULATE(SUM('CostData'[Cost])))Result:
Best Regards,
ZhuIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Your Data and CostData tables should contain actual date columns rather than these exotic foreign keys. If your data has monthly granularity use the first day of the month for the date value.
I have added date columns in both tables and updated the sample report, but still don't know how to get running totals by subtract on first value.
That would be great if you look at the report when you had time.
- lbendlin1 year ago
Super User
What should the date column be for the Cost table?
- vkisa1 year ago
Helper II
I have updated the report as exact dates are added for date1FK,date2FK and cost table. It should be as below
- Anonymous1 year agoNot applicable
Thanks for the replies from lbendlin.
Hi vkisa ,
I am unable to open the link you gave, could you provide a new link that is accessible, thanks in advance for your efforts!
Best Regards,
Zhu