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

Trigger for Selection of actual + next 10 weeks

Hi,

I have set a triggers for a sheet to select the actual week:

Action1:

Field: Year

Search String: =Year(today(2))

Action2:

Field: week

Search String: =Week(today(2))

Is it possible to change the search string that I get the next 10 weeks selected too. And what can I do that this works at the end of the year.

I think there will be a problem if I select week 50 and want the next 10 weeks selected too.

Thanks in advance for your help.

- PS -

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Maybe without the date function:

='>=' & weekstart(today()) & '<=' & weekend(today()+70)


talk is cheap, supply exceeds demand

View solution in original post

9 Replies
Gysbert_Wassenaar

Yes, if weeks cross the year border you need a field that doesn't reset on Jan 1st. You can create such a field in the script from a date field: autonumber(weekyear(MyDate) &'|' & week(MyDate)) as WeekNum.


talk is cheap, supply exceeds demand
peschu123
Partner - Creator III
Partner - Creator III
Author

Hi Gysbert,

Thank you for your reply.

Do I have to "Order by" the table for this or does it just work with a field created like the one you mentioned? The column "WeekNum" looks a bit strange.

table_weeknum.JPG

peschu123
Partner - Creator III
Partner - Creator III
Author

ok I added an "order by Date"

Now it looks like this:

table_weeknum_ordered.JPG

And can you tell me how the Search String has to look like?

Gysbert_Wassenaar

Hmm, I don't think using a week will work. You seem to be missing a lot of dates in between.

Try selecting in Datum. Something like ='>=' & $(=date(weekstart(today()),'DD.MM.YYYY')) & '<=' $(=date(weekend(today()+70),'DD.MM.YYYY'))


talk is cheap, supply exceeds demand
peschu123
Partner - Creator III
Partner - Creator III
Author

The missing dates is nothing to worry about.

The actual dates are fine and I don't need any historical dates for this is just for information and planning, no dates can be chosen at this sheet.

But your expression seems to be a good idea.. I will give it a try.

BTW: I tried to use autonumberhash128 for the WeekNum field and it created the same. No chance without pre- sorting the table through "order by".

Thank you for the expression, the qlikview syntax is killing my brain.

peschu123
Partner - Creator III
Partner - Creator III
Author

There was a missing " & ", I added it, but it always gives me the whole set back, as if there were no selection at all?

Gysbert_Wassenaar

Maybe without the date function:

='>=' & weekstart(today()) & '<=' & weekend(today()+70)


talk is cheap, supply exceeds demand
peschu123
Partner - Creator III
Partner - Creator III
Author

Alright, now it works with:

='>=' & $(=num(date(weekstart(today())))) & '<=' & $(=num(date(weekend(today()+70))))

I used my numerical date field and it works very well.

Thank you very much for your help Gysbert!!!

peschu123
Partner - Creator III
Partner - Creator III
Author

Okay, this works. But not with the numerical field

Now I have 2 solutions... thx again.