Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

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

Re: Any day vs 7 days ago data

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

Re: Any day vs 7 days ago data

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

Re: Any day vs 7 days ago data

Change your dimension to a calculate dimension with expression

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


talk is cheap, supply exceeds demand

Re: Any day vs 7 days ago data

HI

PFA

Not applicable

Re: Any day vs 7 days ago data

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?

Re: Any day vs 7 days ago data

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

Re: Any day vs 7 days ago data

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

mazdamiata
New Contributor

Re: Any day vs 7 days ago data

Hi Gysbert,

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

Many Thanks

Mazda

Community Browser