Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Show previous dates data in same row as date selected

Hi

I am trying to creat a table with one summary row;

Date, sales figure, Previous dates sale figure, Variance.

I am having trouble finding the previous dates sale figure to the one selected by the user on the calender.

Any advice greatly appreciated as I am new to Qlkiview

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Ok, it's a bit more tricky than I accounted for. Attached is an example that works. I use a variable to calculate the previous date and use the variable in the expression for the previous sales. Also I use a calculated dimension so only the selected date shows in the table. I hope this helps you solve your challenge. In the expression for the variable you need to make sure that the Date field you use is a real date, not a text string. Otherwise the max function doesn't work.


talk is cheap, supply exceeds demand

View solution in original post

9 Replies
Gysbert_Wassenaar

You can probably use the above() function to get the previous dates sales figure: above(sales figure)


talk is cheap, supply exceeds demand
vikasgupta
Creator
Creator

Hi Gysbert

Plz I need your help  bcz i did not get any solution for this plz click on following links:-

http://community.qlik.com/thread/68878?tstart=30

thanks

Vikas Gupta

Not applicable
Author

Hi

Thanks for your reply unfortunately this doesnt work.

The calender allows just one date selected therefore only data for  the date selected is brought back.

Regards

Jo

Gysbert_Wassenaar

Try this then:

=sum({<Date={"=$(=max({<Date={'<$(=max(Date))'}>} Date))"}>} [sales figure])


talk is cheap, supply exceeds demand
Not applicable
Author

Hi

Thats not working either - though looks like too many brackets.

I have tried it with all different date formats too.

Ta Jo

Not applicable
Author

I have tried the below to populate the table - Only one date can be selected by the user

//sum({<DateVal={"=$(=max({<DateVal={'<$(=max(DateVal))'}>} DateVal))"}>} SalesRetailGross])

//sum({<DateText={"=$(=max({<DateText={'<$(=max(DateText))'}>} DateText))"}>} SalesRetailGross])

sum({<DateId={"=$(=max({<DateId={'<$(=max(DateId))'}>} DateId))"}>} SalesRetailGross])

DateVal DateText Sales2012-09-19Previous Date
19/09/2012 00:00:002012-09-19£1145448.020

Not sure how to attached the QV to this  discussion

Many Thanks

Gysbert_Wassenaar

Ok, it's a bit more tricky than I accounted for. Attached is an example that works. I use a variable to calculate the previous date and use the variable in the expression for the previous sales. Also I use a calculated dimension so only the selected date shows in the table. I hope this helps you solve your challenge. In the expression for the variable you need to make sure that the Date field you use is a real date, not a text string. Otherwise the max function doesn't work.


talk is cheap, supply exceeds demand
Not applicable
Author

Thankyou very much - I shall try this once im back from my xmas break 🙂

Not applicable
Author

Hi

Thanks that works great thankyou :-).

Jo