Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
zototo
Contributor III
Contributor III

Weekly analysis for current year without current week

Hi everyone!

Believe that there's somewhere an answer to this topic but didn't manage to find it. 

Could you please help with following: 

I need to show sales in a chart only for the current year on a weekly basis but without current week (because it distorts my data). 

I tried different expression options for both - dimension and variable and none of those things worked out.

Looking forward for your help:)

Thank you! 

Labels (3)
5 Replies
chaorenzhu
Creator II
Creator II

If you have already created year and week fields using Year() and Week(), just use

sum({<year={$(=Year(Today()))},week-={$(=Week(Today()))}>} sales)

sidhiq91
Specialist II
Specialist II

@zototo  As @chaorenzhu  mentioned you can use the above expression. In case if you have not created Year and Week field and wanted the result based on the date field then you can use the below expression.

SUm({<OrderDate={">=$(=Weekstart(Yearstart(Today())))<=$(=Date(Weekend(Today())-7,'MM/DD/YYYY'))"}>}LineSalesAmount)

This should resolve your issue.

zototo
Contributor III
Contributor III
Author

thank you for an answer:)

Unfortunately, it didn't work out. I tried your solution and still there's a data for all previous years too.  

I have master calendar based on kinda "orderdate" and to me it seems like it takes just weeks numbers into account but without considering a current year. 😓

Or there's smth wrong in my master calendar? 

zototo
Contributor III
Contributor III
Author

Thank you for your reply!:) 

It is working the way better but still it considers last week of the previous year (starting 27.12.2021 cause it's Mon) and in chart it's like:

w1-w31 and right after that w53. Can I exclude last year data somehow? 

Thank you! 

sidhiq91
Specialist II
Specialist II

@zototo  Could you please use the below expression:

SUm({<OrderDate={">=$(=Date(Yearstart(Today()),'MM/DD/YYYY'))<=$(=Date(Weekend(Today())-7,'MM/DD/YYYY'))"}>}LineSalesAmount)

I think this should resolve the issue.