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: 
New-Qlik
Creator III
Creator III

Comparing This week profit with LY this week profit wrt same no of days

Hello.

I want to compare this week data with LY same week data  but not full last year week

Like this week we have data till yesterday i.e 2020-03-18 (Wednesday) so for Last year it should show data till Wednesday only. 

2 Replies
bharadwaj
Partner - Contributor II
Partner - Contributor II

Hi,

This can be achieved by creating four variables as follows:

Variable 1:   weekstart(max(Date).                                   

Variable 2: Max(Date)

Variable 3:   Addyears(weekstart(max(Date),-1)       

  Variable 4: Addyears(Max(Date),-1)

Now we can use these variables in set analysis and compare this year's current week trend and last year's current week trend.

e:g: For Current Year current week:- Sum({<Date={">=$(Variable1)<=$(Variable2)"}Sales)

        For Last Year Current Week :- Sum({<Date={">=$(Variable3)<=$(Variable4)"}Sales).

I used Variables because those can be re used,if you want you can use the direct expressions instead of variables in the set analysis.

Hope it helps

Thanks & Regards...!!!

 

New-Qlik
Creator III
Creator III
Author

Thanks for replying . Some how variables are correct but set analysis is not working it gives zero which is wrong