Forum Discussion
LTM calculation using different reference dates
- Anonymous3 years ago
Hi powerbiAG ,
If you want to calculate the last 12 months Sales Value (Historic) data (for each business) based on the "integration month" in the fact table, I think LTM Value Historic for Org Id =1 should be 200+120 instead of 100+200+120. Due to Integration Month for Org Id =1 is 2021/Feb, so last 12 month should be from 2020/Feb to 2021/Jan. So 2020/Jan is not in range.
Try code as below to create a calculated column.
LTM Value Historic = VAR _Last12months = FILTER ( CALENDARAUTO (), [Date] <= EOMONTH ( 'Table'[Integration Month], -1 ) + 1 && [Date] >= EOMONTH ( 'Table'[Integration Month], -13 ) + 1 ) RETURN CALCULATE ( SUM ( 'Sales transaction (historic)'[Value (Historic)] ), FILTER ( 'Sales transaction (historic)', 'Sales transaction (historic)'[Month] IN _Last12months ) )Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi powerbiAG ,
If you want to calculate the last 12 months Sales Value (Historic) data (for each business) based on the "integration month" in the fact table, I think LTM Value Historic for Org Id =1 should be 200+120 instead of 100+200+120. Due to Integration Month for Org Id =1 is 2021/Feb, so last 12 month should be from 2020/Feb to 2021/Jan. So 2020/Jan is not in range.
Try code as below to create a calculated column.
LTM Value Historic =
VAR _Last12months =
FILTER (
CALENDARAUTO (),
[Date]
<= EOMONTH ( 'Table'[Integration Month], -1 ) + 1
&& [Date]
>= EOMONTH ( 'Table'[Integration Month], -13 ) + 1
)
RETURN
CALCULATE (
SUM ( 'Sales transaction (historic)'[Value (Historic)] ),
FILTER (
'Sales transaction (historic)',
'Sales transaction (historic)'[Month] IN _Last12months
)
)
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Rico,
Thanks for the reply.
I tried to replicate your solution, but am getting error which says "A single value for column 'Integration Month' in table 'Table' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum...."
Am I missing something ?
Any advise would be highly appreciated.