Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Michael4
Contributor
Contributor

How to get last year date peroid

Hi expert,

I am new to Qlik, now I tried to use the date range picker to let the user select date period of current year and I want to calculate the sales volume comparison between last year and this year. can somebody tell me how to do it? thanks.

Labels (1)
1 Solution

Accepted Solutions
PrashantSangle

Hi,

use addYears() in set analysis

use set analysis for that. try below

Sum({<date={">=$(=date(AddYears(min(date_field),-1)))<=$(=date(AddYears(max(date_field),-1)))"}>}Sales)

 

Regards,

Prashant Sangle

 

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

View solution in original post

4 Replies
Michael4
Contributor
Contributor
Author

just bring more background information. Let's say when the user picks the time period for examples 03/01/2020 ~04/15/2020, then I want to calculate the sales amount during the same time period of 2020 and 2019. my question is how to get user input and how to convert it to the 2019 time period.

Can anybody help me out?  Thanks.

Michael

Steven_Haught
Creator III
Creator III

Can you share a little data or an example of your app? 

PrashantSangle

Hi,

use addYears() in set analysis

use set analysis for that. try below

Sum({<date={">=$(=date(AddYears(min(date_field),-1)))<=$(=date(AddYears(max(date_field),-1)))"}>}Sales)

 

Regards,

Prashant Sangle

 

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Michael4
Contributor
Contributor
Author

thank you @PrashantSangle