Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Newhaven
Contributor III
Contributor III

Week-Year values ​​from the last year

Hy!

 

I have da date string Week-Year (example 15-2021) and values.

Now I need the value 5 Weekes ago.

This is no problem during th year, but I have problem with the turn of the year 

 

Example

2-2021

I need the value  from the week 50-2020 (5 weeks ago)

 

Do you have any idea (need it in the script, not in a chart)?

 

 

Thx

1 Solution

Accepted Solutions
Vegar
MVP
MVP

Vegar_0-1629375657484.png

Assuming you have a field named Week_Year. Then you can accomplish this by this expression.

Week(MakeWeekDate(SubField(Week_Year,'-',2),SubField(Week_Year, '-',1))-5*7)
&'-'&
WeekYear(MakeWeekDate(SubField(Week_Year,'-',2),SubField(Week_Year,'-',1))-5*7)

 

It can be used both in the script and as an expression in the front end.

View solution in original post

2 Replies
Vegar
MVP
MVP

Vegar_0-1629375657484.png

Assuming you have a field named Week_Year. Then you can accomplish this by this expression.

Week(MakeWeekDate(SubField(Week_Year,'-',2),SubField(Week_Year, '-',1))-5*7)
&'-'&
WeekYear(MakeWeekDate(SubField(Week_Year,'-',2),SubField(Week_Year,'-',1))-5*7)

 

It can be used both in the script and as an expression in the front end.

Newhaven
Contributor III
Contributor III
Author

Perfekt! Thx for your help 🙂