Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Any day vs 7 days ago data

Hi all!

I have the following data:

Date and Value.

In table I want to get the Value for any Day, but alsoValue for the 7 days ago:

Date and Value.png

I use the expression: sum( {$<Day=,Month =,Date = {"$(=date(Date-7))"}>}Value ) but it doesn't work correctly.

In Qlickview like this:

result.png

For any date i must have 2 Values : Value for date and Value for date-7 ago but idon't know how to solve this problem without load two values in script. Can any help?


8 Replies
Gysbert_Wassenaar

You can't solve this with set analysis expressions. Those are calculated once for the entire chart, not per row. If you have Values for every day and the dates are ordered like in your example you can use above(sum(Value),7) as the expression to get the sum(Value) of 7 rows above, which in this case is also 7 days ago.


talk is cheap, supply exceeds demand
Not applicable
Author

Thank you, Gysbert ! It doen't suit mе..

Gysbert_Wassenaar

Change your dimension to a calculate dimension with expression

=GetFieldSelections( Day) & '-' & GetFieldSelections( Month)


talk is cheap, supply exceeds demand
MayilVahanan

HI

PFA

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Gysbert and Mayil, Thank you! Both of solutions show value when i select day and month.

Can i see value vs previous value for all days in month? I.e. if i select month, no selection day?

Gysbert_Wassenaar

That's not possibly with set analysis expressions. The set is calculated for the entire chart/table, not per row. You'll have to deal with it in the load script. It's fairly easy. See attached example.


talk is cheap, supply exceeds demand
Not applicable
Author

O'key, i understood, thank you,Gysbert!

Anonymous
Not applicable
Author

Hi Gysbert,

Im using Qlikview personal edition. can i have the script paste here?

Many Thanks

Mazda