2 Replies Latest reply: Dec 5, 2016 2:14 AM by Lakshmikandh Karthikeyan

# Sales for current and previous year with if statement

Hi Everyone,

I am looking to create an if statement calculation that says: if it is the current year then return sales.

If possible, I want to accomplish this without a set analysis and without having to create a master calendar as these are just quick calculations that need to be made.

I have something like: sum(if(year(Booked_Date)= Max(year(Booked_Date))), Booked Amount))

Can't get this to work for some reason.

I am also trying to do the same for the previous years' sales.

Please let me know if I'm missing something.

Thanks!

• ###### Re: Sales for current and previous year with if statement

Sorry meant to write: sum(if(year(Booked_Date)= Max(year(Booked_Date)), Booked Amount)) which is still not working though

• ###### Re: Sales for current and previous year with if statement

Declare this in Load script variable Let mYr = '=Max(year(Booked_Date))';

And try this expression sum(if(match(year(Booked_Date),\$(mYr) ), Booked Amount))