Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set analysis and start month

Hello,

my name is Betty and I'm new at this. I want to make a set analysis where I compare this years sale to last years sale and I want to start from January. I've actually made one, but can't seem to figure out how to make it start from january. Can you please help me out a little? 😃

This is the expression I've written (know that I don't use dollar signs since I' m a swede):

sum({<year={2014}>}sales)

sum({<year={2015}>}sales)

Also, this store opened 2014 and so I only have sales information from 2014-2015, but let's say that 2016 comes. I don't want to have to write another expression only for that year. Is there also a better way to make an expression that will apply to all years?

Sincerely,

Betty

4 Replies
brunobertels
Master
Master

Hi try like this to get current , and previous  n years :

current year :

sum({<year={$(=year(Today()))}>}sales)

last year :

sum({<year={$(=year(Today())-1)>}sales)

past last year :

sum({<year={$(=year(Today())-2)>}sales)

Bruno

Not applicable
Author

Hi Betty,

You could try using variables to define current and previous year:

- vCurrentYear = Year

- vPreviousYear = Year -1

Then add the variables to your set analysis:

- CY Sales = sum({<year = {$(vCurrentYear)}>} Sales)

- PY Sales = sum({<year = {$vPreviousYear}>} Sales)

Once you select 2015 second column will update to 2014. If you want to work with real dates, you can use Now() and Year() functions as well.

Good luck!

Tom

Not applicable
Author

Thank you guys for answering so quickly! I managed to fix it yesterday =D