Reply
Highlighted
Regular Visitor
Posts: 36
Registered: ‎04-06-2017

Re: Comparison- current month vs previous month

I've found that creating a date table with every required breakdown of the date (ie: Month number, Week number) is a good practice. This numbering should just be a sequential number from the begining of your date range of the date table to the most recent date. That way you can use simple DAX like: Lead PM = CALCULATE([Leads], FILTER(ALL(CreateDateTable), CreateDateTable[MonthNumber]= MAX(CreateDateTable[MonthNumber])-1).  If the MonthNumber is a running number from 1 to 36 for a 3 yr period, then you don't won't have an issue considering the year.  Same can apply to Week number.

This article was helpful:  http://www.daxpatterns.com/time-patterns/

 

Advisor
Posts: 52
Registered: ‎12-17-2015

Re: Comparison- current month vs previous month

Here are some tutorials on generating a date calendar with an Index for months, Years, Days, and weeks.  This uses the same logic as @steph_io  Great solution.

 

https://powerbi.tips/2017/11/creating-a-dax-calendar/

 

https://powerbi.tips/2017/12/start-of-month-dax-calendar/

Mike Carlo ( https://powerbi.tips )
mike@PowerBI.Tips