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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
SRSB
Partner - Contributor III
Partner - Contributor III

Get values at the previous dates

Hello,

I have a calculated field Note, where my user choses three dates 

then I want to calculate sum(Note) of the last 10 previous dates of the chosen date by my user.

for example if my user choses 29/072019 , I have to Sum the values of the following dates

 

 

Thank you,

Best regards.

1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

@SRSB May be this for your set analysis

StartDATE = {">=$(=Date(Max({<StartDATE = {[<$(=Date(Max(StartDATE), 'DD-MM-YYYY'))]}>} StartDATE, 10), 'DD-MM-YYYY'))<=$(=Date(Max(StartDATE), 'DD-MM-YYYY'))"}

 

View solution in original post

4 Replies
sunny_talwar
MVP
MVP

@SRSB May be this for your set analysis

StartDATE = {">=$(=Date(Max({<StartDATE = {[<$(=Date(Max(StartDATE), 'DD-MM-YYYY'))]}>} StartDATE, 10), 'DD-MM-YYYY'))<=$(=Date(Max(StartDATE), 'DD-MM-YYYY'))"}

 

SRSB
Partner - Contributor III
Partner - Contributor III
Author

Thank you for your help.

In fact I have to get the 10 previous dates of a date chosen from an alternate state, then calculate the number of notes that are out of a precalculated range.

COUNT(distinct{<
Descripteur=P({State1}Descripteur),
AgeProd= P({State1}AgeProd),
//StartDATE={">=$(vLast10)<=$(vEndDate_State1)"},
StartDATE = {">=$(=Date(Max({<StartDATE = {[<$(=Date(Max(StartDATE), 'DD-MM-YYYY'))]}>} StartDATE, 10), 'DD-MM-YYYY'))<=$(=Date(Max(StartDATE), 'DD-MM-YYYY'))"},
note={"<$(v_Moins)>$(v_Plus)"}
>} note)

my StartDate should be in [last 10 date before the chosenEndDate(state1),chosenEndDate(state1)]

 

Is this possible ?

sunny_talwar
MVP
MVP

@SRSB That is what it should be doing, is it not?

SRSB
Partner - Contributor III
Partner - Contributor III
Author

In fact, I just have a problem with my variable, otherwise your solution works perfectly ! Thanks 😊