Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

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!

2 Replies
Not applicable

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

lakshmikandh
Valued Contributor II

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))