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

Announcements
Now accepting applications for the Qlik Luminary and Partner Ambassador Programs: Apply by July 6!
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
MVP
MVP

maybe this:

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

I hope it helps.

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it
Thierno
Contributor III
Contributor III
Author

i tried it but it gives me this :

Capture 1.PNG

PS: it's a KPI

agigliotti
MVP
MVP

try to create a text box with this expression:

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


and check what you get.

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it
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
MVP
MVP

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

in the script I have:

SET FirstWeekDay=6;

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it
agigliotti
MVP
MVP

anyway the right syntax is:

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

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it
Thierno
Contributor III
Contributor III
Author

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

agigliotti
MVP
MVP

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.

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it
Thierno
Contributor III
Contributor III
Author

here the right answer :

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