Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
aresb
Creator
Creator

How to get previous year from autoCalendar.Year

Hi everyone,

im starting to taking confidence with set expression.

My goal is to visualize YoY sum(sales) from a year who i can get from Order Date.autoCalendar.Year.

this is my set expression

sum({<[Order Date.autoCalendar.Year] = {[Order Date.autoCalendar.Year]}-1>}Sales)

aresb_0-1655302731351.png

 

Can you help me to figure out why?

 

Labels (2)
3 Replies
lironbaram
Partner - Master III
Partner - Master III

Actually, you have an even simpler solution:
 

 

sum({<[Order Date.autoCalendar.YearsAgo] = {1}>}Sales)

if you want a  dynamic expression you can use this:

 

sum({<[Order Date.autoCalendar.YearsAgo] = {"$(=min([Order Date.autoCalendar.YearsAgo])+1)"}>}Sales)​
aresb
Creator
Creator
Author

it doesn't work...

i managed a solution like this one

Sum({<[Order Date.autoCalendar.Year] = {$(=year([Order Date.autoCalendar.Year])-1)}>} Sales)

 

vinieme12
Champion III
Champion III

Sum({<[Order Date.autoCalendar.Year] = {"$(=Max([Order Date.autoCalendar.Year],2))"}>} Sales)

 

OR

 

Sum({<[Order Date.autoCalendar.Year] = {"$(=Max([Order Date.autoCalendar.Year])-1)"}>} Sales)
Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.