Forum Discussion
direct query previous month
- 9 years ago
Hi steph_io,
If I understand you correctly, you should be able to follow steps below to get your expected result. :smileyhappy:
1. Use the formula below to add new calculate column in your DimDate table.
YearMonth = YEAR ( DimDate[FirstDayOfMonth] ) * 12 + MONTH ( DimDate[FirstDayOfMonth] )2. Then you should be able use the formula below to calculate the Trans Accounts PM.
Trans Accounts PM = CALCULATE ( [Trans Accounts], FILTER ( ALL ( DimDate ), DimDate[YearMonth] = MAX ( DimDate[YearMonth] - 1 ) ) )Regards
Hi steph_io,
If I understand you correctly, you should be able to follow steps below to get your expected result. :smileyhappy:
1. Use the formula below to add new calculate column in your DimDate table.
YearMonth =
YEAR ( DimDate[FirstDayOfMonth] ) * 12
+ MONTH ( DimDate[FirstDayOfMonth] )
2. Then you should be able use the formula below to calculate the Trans Accounts PM.
Trans Accounts PM =
CALCULATE (
[Trans Accounts],
FILTER ( ALL ( DimDate ), DimDate[YearMonth] = MAX ( DimDate[YearMonth] - 1 ) )
)
Regards
- steph_io9 years ago
Advocate II
This also resolves the issue I had with my calculations not looking at prior month when it fell in prior year. My formula wasn't working for each january. Thank you!