Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
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
You can also read through these series of blog posts:
The Magic Of Set Analysis Archives • AfterSync - QlikView Consulting
The Magic of Set Analysis - Point In Time Reporting • Blog • AfterSync
Thank you guys for answering so quickly! I managed to fix it yesterday =D