Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Thierno
Contributor III
Contributor III

How to filter data on the previous week?

Hi everyone !


I solicit your help because it's been over a week that I use Qlik and I have a lot of trouble with the syntax of set analysis. I can not filter my data (which runs from August 2017 to today) weekly.

My goal is to show the sum of the numbers only from last week. Here is the last iteration of my work:

Sum ({$ <semaine = {"= $ (= week (weekstart (today (), -1, first_week_day = 0)))"}>} etat_ok)

"semaine" is a column containing the number of the week (0 -> 53)

Can you tell me what's wrong? Or maybe point me to a document explaining how set analysis works ? or both ?

1 Solution

Accepted Solutions
Thierno
Contributor III
Contributor III
Author

here the right answer :

sum( {$<semaine ={"$(=week(weekstart( today(), -1, 0)))"}>} etat_ok )

View solution in original post

10 Replies
agigliotti

maybe this:

=Sum( {< semaine = {"$(=week( weekstart(today()-7) ))"} >} etat_ok )

I hope it helps.

Thierno
Contributor III
Contributor III
Author

i tried it but it gives me this :

Capture 1.PNG

PS: it's a KPI

agigliotti

try to create a text box with this expression:

=week( weekstart(today()-7) ))


and check what you get.

Thierno
Contributor III
Contributor III
Author

the good writing is this : Week(WeekStart(Today(), -1, 0)), here the definition of weekStart you'll understand the function

https://help.qlik.com/en-US/sense/June2017/Subsystems/Hub/Content/Scripting/DateAndTimeFunctions/wee...

The one you gave me return blank box.

But mine give me : 38 as the number of last week. that one is good.

The problem is when i add this thing to the sum. it doesn't do the filter at all.

See :

Capture 2.PNG

agigliotti

actually I get 38 as result using the expression I gave you.

in the script I have:

SET FirstWeekDay=6;

agigliotti

anyway the right syntax is:

semaine = {"$(=Week(WeekStart(Today(), -1, 0)) ) "}

Thierno
Contributor III
Contributor III
Author

oh tx, can you explain me what's the difference between my syntax and yours ?

agigliotti

in your syntax there is an equal sign more,

semaine = {"=$(=Week(WeekStart(Today(), -1, 0)) ) "}


remember to mark the correct answer if applicable, to help other community members.

Thierno
Contributor III
Contributor III
Author

here the right answer :

sum( {$<semaine ={"$(=week(weekstart( today(), -1, 0)))"}>} etat_ok )