Forum Discussion
Cumulative Formula by date
- Anonymous1 year ago
Hi, AivaS
Thank you for your prompt response.1.You can try the following measure:
Measure = VAR table1 = SUMMARIZE( ALLSELECTED('summary_by_month'), 'summary_by_month'[Date].[Month], "AVG", VAR cm = 'summary_by_month'[Date].[Month] VAR _averageProfit = CALCULATE( AVERAGE(summary_by_month[profit]), FILTER( ALL(summary_by_month), 'summary_by_month'[Date].[Month] = cm ) ) RETURN _averageProfit, "INEDX1", SWITCH( 'summary_by_month'[Date].[Month], "January", 1, "February", 2, "March", 3, "April", 4, "May", 5, "June", 6, "July", 7, "August", 8, "September", 9, "October", 10, "November", 11, "December", 12 ) ) VAR table2 = SUMMARIZE( table1, 'summary_by_month'[Date].[Month], [INEDX1], "running", SUMX( FILTER(table1, [INEDX1] <= EARLIER([INEDX1])), [AVG] ) ) VAR f = SUMX( FILTER(table1, [INEDX1] = MAX([INEDX1])), [AVG] ) VAR f1 = SUMX( FILTER(table2, 'summary_by_month'[Date].[Month] = MAX('summary_by_month'[Date].[Month])), [running] ) RETURN IF( ISINSCOPE('summary_by_month'[Date].[Month]), f1, f )2.Here's my final result, which I hope meets your requirements.
Please find the attached pbix relevant to the case.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I thinkI need to add a filter in the formula? it seems then I use the "Calendar" Table, I get this resulin the table ?
Sum of profit being a column, Profit M being a measure, RT profit is the one I amtrying to work out.
- Anonymous1 year agoNot applicable
Hi, AivaS
Thank you for your prompt response.1.You can try the following measure:
Measure = VAR table1 = SUMMARIZE( ALLSELECTED('summary_by_month'), 'summary_by_month'[Date].[Month], "AVG", VAR cm = 'summary_by_month'[Date].[Month] VAR _averageProfit = CALCULATE( AVERAGE(summary_by_month[profit]), FILTER( ALL(summary_by_month), 'summary_by_month'[Date].[Month] = cm ) ) RETURN _averageProfit, "INEDX1", SWITCH( 'summary_by_month'[Date].[Month], "January", 1, "February", 2, "March", 3, "April", 4, "May", 5, "June", 6, "July", 7, "August", 8, "September", 9, "October", 10, "November", 11, "December", 12 ) ) VAR table2 = SUMMARIZE( table1, 'summary_by_month'[Date].[Month], [INEDX1], "running", SUMX( FILTER(table1, [INEDX1] <= EARLIER([INEDX1])), [AVG] ) ) VAR f = SUMX( FILTER(table1, [INEDX1] = MAX([INEDX1])), [AVG] ) VAR f1 = SUMX( FILTER(table2, 'summary_by_month'[Date].[Month] = MAX('summary_by_month'[Date].[Month])), [running] ) RETURN IF( ISINSCOPE('summary_by_month'[Date].[Month]), f1, f )2.Here's my final result, which I hope meets your requirements.
Please find the attached pbix relevant to the case.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.