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

trailing 8 weeks from saturday of current week.

hi all,

 

I have a amount column with transaction date.

I want to see sum amount of trailing 8 weeks using the transaction date and from the saturday of today's date.

 

for example today is 3/1/2023, I want to see trailing 8 weeks of sales from 3/4/2023 and back to 8 weeks.

any one has a handy set analysis for that.

Labels (1)
4 Replies
Clever_Anjos
Employee
Employee

If you use the "Create Calendar Measure" wizard, Qlik Sense will autogenerate some master items for you
You can play with them choosing which weeks you want to include.

It will be something like 

Sum( {< [DateField.autoCalendar.WeeksAgo]={"<=8"} > } [Value] )

Clever_Anjos_0-1677703187509.png

 

alec1982
Specialist II
Specialist II
Author

thank you. I am trying to do this in set analysis as I am dealing with multiple dates with various expression.

Gabbar
Specialist
Specialist

I am assuming your datefield in Number Format.
Try this:

Sum({< DateField={"=$(=Floor(Num(weekend(Max(DateField)),-56)))"}>}Amount)

If you DateField is in Date format try this:
Sum({< DateField={"=$(=Date(Floor(Num(weekend(Max(DateField)),-56))))"}>}Amount)


Clever_Anjos
Employee
Employee

That´s the "trick", instead of using a hard to maintain date expression you can use the derived week field to make you life easier 

Sum( {< [DateField.autoCalendar.WeeksAgo]={"<=8"} > } [Value] )

Means "sum all values from previous 8 weeks"