Forum Discussion
Comparison- current month vs previous month
- Anonymous9 years ago
Sure there is a way! :-)
You can use DAX to creat the appropriate measures to show in your matrix. See some example here: https://powerbi.tips/2016/07/measures-month-to-month-percent-change/.
But first you need to make sure the Date column is of Date data type - you need this in order to use Time Intelligence functions in DAX and to allow Power BI to deal with time hierarchy.
Hope that helps.
Cheers,
Pawel
- Anonymous9 years ago
OK, try out this .pbix file and see if the approach used inside fits your need: http://blog.sqlgeek.pl/Download/DAX - Month over Month.pbix.
I used the same DAX function mentioned in the article (PREVIOUSMONTH). And presence of the regions in your data doesn't change much.
Cheers,
Pawel
- Anonymous9 years agoInstead of PREVIOUSYEAR use SAMEPERIODLASTYEAR function.
Hello Anonymous
Thank you for your contribution to this topic.
I am looking for same type of comparison, but just with current weeknum vs. previous weeknum.
I have tried Google, and there does not seem to be a PREVIOUSWEEK function like there is a PREVIOUSMONTH function you refer to.
How would you go about comparing week numbers?
Best regards
David
- steph_io8 years agoAdvocate II
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/
- Mike_Carlo8 years agoMost Valuable Professional
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/