3 Replies Latest reply on Apr 20, 2018 5:24 PM by swaroop.gantela

# how to calculate difference between any month vs december last year

Hi!

i been ask to do a calculation where we can see the difference between any given month vs december last year.

I need to be able to see all of the sales of  2017 and 2018 by month against december last year

Sales march 2018 - sales december 2017

sales february 2018 - sales december 2017

....

....

Sales jun 2017 -  december 2016...

etc

Can anyone plis help me out? to find a way to do this?

Thank you so much!

KL

• ###### 1. Re: how to calculate difference between any month vs december last year

Karen,

Please see if the workbook attached in the Forum thread can give some ideas.

First step is to get the difference in months between month in question and previous December:

[MonthDifference]:

DATEDIFF('month', DATETRUNC('month',[Order Date]), MAKEDATE(YEAR([Order Date])-1,12,1))

Then lookup value for that previous December [LookupPreviousDec]:

LOOKUP(SUM([Sales]),MIN([MonthDifference]))

Then the difference is:

SUM([Sales])-[LookupPreviousDec]

This should work if you have data for every month.

There will need to be some modification if some months are missing data.

1 of 1 people found this helpful
• ###### 2. Re: how to calculate difference between any month vs december last year

HI!

Thanks so much for your help!

it works perfectly!

i just would like to ask, in case you know,

im trying to do a graph where i have only the months,

and i can put the year on color and i get this difference month vs last December,

but whit this formula i does not work for some reason.

do you know what i could do?

thanks so much!

• ###### 3. Re: how to calculate difference between any month vs december last year

Karen,

I think the calculation is generally working correctly, but

the issue is that in this dataset there is no value for December 2015,

so the 2016 have no value to compare to. If you can include

the December 2015 Sales, I think it will look correct.

If December 2015 is not available, I made an arbitrary fix that

if the year is the very first one, compare to the sales in January

instead of December.

Please see the workbook attached in the Forum thread.