Forum Discussion
Dynamic two month calculation like Dec 2021 + jan 2022
- Anonymous4 years ago
Hi vijay_27 ,
1. Let's assume the MonthCombine is not include in data source, you could use the following formula to get it:
MonthCombine = [Month]&" + " &CALCULATE(MAX('Table'[Month]),FILTER('Table',[Rank]=EARLIER('Table'[Rank])+1))2. Then please create rank column in order to get the value of next month :
YeearMonth = [Year]*100+MONTH( CONVERT([Year]&" "&[Month]&" 1", DATETIME) )Rank = RANKX('Table',[YeearMonth],,ASC,Dense)3. Sort MonthCombine column by Rank, the final table is as shown below:
Finally, create a measure:
Measure = SUM('Table'[Value])+ CALCULATE(SUM('Table'[Value]),FILTER(ALLSELECTED('Table'),[Rank]=MAX('Table'[Rank])+1))Output:
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi vijay_27 ,
1. Let's assume the MonthCombine is not include in data source, you could use the following formula to get it:
MonthCombine = [Month]&" + " &CALCULATE(MAX('Table'[Month]),FILTER('Table',[Rank]=EARLIER('Table'[Rank])+1))
2. Then please create rank column in order to get the value of next month :
YeearMonth = [Year]*100+MONTH( CONVERT([Year]&" "&[Month]&" 1", DATETIME) )Rank = RANKX('Table',[YeearMonth],,ASC,Dense)
3. Sort MonthCombine column by Rank, the final table is as shown below:
Finally, create a measure:
Measure = SUM('Table'[Value])+ CALCULATE(SUM('Table'[Value]),FILTER(ALLSELECTED('Table'),[Rank]=MAX('Table'[Rank])+1))
Output:
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- vijay_274 years ago
Helper I
Anonymous Thank you so much for help this.