Forum Discussion
DAX
Hi all,
How to do Privous month calculation like i have current month (100)-privous month (50) = 50
how to do in dax..
Thanks
Hey,
do you have a separate Calendar table, if not you should ;-) And make sure both tables are related properly.
Then you should give PREVIOUSMONTH a try like so:
CALCULATE(SUM('yourtable'[yournumericcolumn]), PREVIOUSMONTH('calendar'[Date]))Here you will find almost everything about time intelligence with DAX:
http://www.daxpatterns.com/time-patterns/
If you are new to the sometimes mind-boggling DAX statements I would wholeheartedly recommend the following books
also in this sequence
- Analyzing Data with Microsoft Power BI and Power Pivot for Excel
- Dax Patterns 2015
- The Definitive Guide to DAX
All three have been written by Marco Russo and Alberto Ferrari
Hope this gets you started
The subtraction can look like this
CALCULATE(SUM('yourtable'[yournumericcolumn])) - CALCULATE(SUM('yourtable'[yournumericcolumn],PREVIOUSMONTH('calendartable'[date]))
Cheers
9 Replies
- TomMartensSuper User
Hey,
do you have a separate Calendar table, if not you should ;-) And make sure both tables are related properly.
Then you should give PREVIOUSMONTH a try like so:
CALCULATE(SUM('yourtable'[yournumericcolumn]), PREVIOUSMONTH('calendar'[Date]))Here you will find almost everything about time intelligence with DAX:
http://www.daxpatterns.com/time-patterns/
If you are new to the sometimes mind-boggling DAX statements I would wholeheartedly recommend the following books
also in this sequence
- Analyzing Data with Microsoft Power BI and Power Pivot for Excel
- Dax Patterns 2015
- The Definitive Guide to DAX
All three have been written by Marco Russo and Alberto Ferrari
Hope this gets you started
- AmalrajRRD1Helper II
here i can see the differences right?
Thanks
- TomMartensSuper User
No, my example just gets you to calculate the value for the previous month, finally you have to do the subtraction :-)