Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi all,
I am calculating the delta percentange of my data Month by Month. I use this two measures:
Past Month: CALCULATE (SUM('Stock'[unit]),FILTER('Stock',DATEADD('Stock'[dates],-1,MONTH))) Present Month: CALCULATE(SUM('Stock'[unit]), FILTER('Stock',DATEADD('Stock'[dates],-0,MONTH)))
The problem is regarding the difference Present - Past and then Divide it by the Past then the result doesn't make any sense.
I know is taking different periods but I can't find a way to make them substrack correctly. I try also with PREVIOUS MONTH and DATEADD (date, -1,Month) but nothing.
Also all my relationship in the model are fine.
here is a screenshot from the graphic
.
The Last part is the division in from the 1785 and 2493
Thanks,
Jorge
Solved! Go to Solution.
Okay I just noticed you are not referencing a Calendar Table with DATEADD
DATEADD requires contiguous date selection like in a Calendar Table
"The Main reason why a Date Table should include all days within a year is because of DATEADD behavior"
The Definitive Guide to DAX page 194
Change Past Month to this instead
Past Month = CALCULATE ( SUM ( 'Stock'[unit] ), PREVIOUSMONTH ( 'Stock'[dates].[date] ) )
Now because you are plotting on an X-Axis - Year Month (you can do this to quickly see)
MoM % Change = DIVIDE ( SUM ( 'Stock'[unit] ) - [Past Month], [Past Month], 0 )
Hope this helps!
Good Luck!
The formulas seem fine and should work!
Except this maybe a typo but just in case
in the 1st you are referencing column [units] in the second [unit] are those different columns?
@Sean Thanks for the correction, It was unit. Should work fine but if you see the data the difference is not fine I seem to get a difference range of dates and that makes the worng difference between the months.
Okay I just noticed you are not referencing a Calendar Table with DATEADD
DATEADD requires contiguous date selection like in a Calendar Table
"The Main reason why a Date Table should include all days within a year is because of DATEADD behavior"
The Definitive Guide to DAX page 194
Change Past Month to this instead
Past Month = CALCULATE ( SUM ( 'Stock'[unit] ), PREVIOUSMONTH ( 'Stock'[dates].[date] ) )
Now because you are plotting on an X-Axis - Year Month (you can do this to quickly see)
MoM % Change = DIVIDE ( SUM ( 'Stock'[unit] ) - [Past Month], [Past Month], 0 )
Hope this helps!
Good Luck!
HI, I have same problem and I,m using similare formula as below:
OTE Last Month = CALCULATE([AVG OTE Score], PREVIOUSMONTH('OTE-FCR'[INTERACTION_DATE (-06:00 GMT)].[Date]))
but the result above formula returns is zero! I can't understand why?!
Do you see any errors?
Thanks a lot
@Sean Totally right! then I did something different just take out the filter because it was creating a conflict. But yes thank you! I didn't know that DATEADD was rigourus about the dates!
User | Count |
---|---|
140 | |
113 | |
104 | |
77 | |
65 |
User | Count |
---|---|
135 | |
117 | |
101 | |
71 | |
61 |