Forum Discussion
Anni_E_Lehtinen
8 years agoFrequent Visitor
Previous month function that takes January into consideration
Hi! I have been trying to figure out a previous month- DAX function that takes into account that in January previous month's year is not the same as the current month's year. I am currently ...
- 8 years ago
Thanks sdjensen! I actually just figured this out like this:
IsPreviousMonth = IF(MarketingMonthly[YearMonth]=FORMAT(DATE(YEAR(TODAY()),MONTH(TODAY())-1,DAY(TODAY())),"YYYY/MM"),"Previous","Other")
Problem solved :)
sdjensen
8 years agoSolution Sage
Add an IF to the calculation that check if the month is january - if true handle the calculation differently else do what do now.
Anni_E_Lehtinen
8 years agoFrequent Visitor
Thanks sdjensen! I actually just figured this out like this:
IsPreviousMonth = IF(MarketingMonthly[YearMonth]=FORMAT(DATE(YEAR(TODAY()),MONTH(TODAY())-1,DAY(TODAY())),"YYYY/MM"),"Previous","Other")
Problem solved :)