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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to compare a value from the selection to another value which is not selected.

Hi there,

I have a list box with dates.

error loading image

I want to calculate a value based on the selected date and last date. E.g. If a user selects 01/11/2010, I have to calculate previous date's balance whcih is the balance on 15/10/2010.

error loading image

I am not sure how to really do it.. any help would be great.

Much Appreciated.

8 Replies
Not applicable
Author

Hi,

If your first expression is sum(SALES)

The second should be sum({<[Statement Date]={'$(=date(max({1}[Statement Date])))'}>} SALES)

Regards

Benoît

Not applicable
Author

Hi Bcuisiniere,

Thanks for your reply, it does work but Im not sure I want the maximum date in the list. I want the maximum date less than selected statement date. Can you please also help me the label part. I want it to be

Previous Balance [Date]

where Date will be previous statement date.

ta.

Not applicable
Author

Hi

I made a mistake between 15/12/2010 and 15/10/2010.

then try sum({<[Statement Date]={'$(=date(max({1<[Statement Date]={"<$(=date(only([Statement Date])))"}>}[Statement Date])))'}>} SALES)

and the label

='Previous Balance '& date(max({1<[Statement Date]={"<$(=date(only([Statement Date])))"}>}[Statement Date]))

Not applicable
Author

Hi mate,

Sorry was on holiday for a couple of days. It still doesn't seem to work. 😞

deepakk
Partner - Specialist III
Partner - Specialist III

HI,

I am not sure if it is a Correct approach but the attach application servers the purpose.

Not applicable
Author

use peek function in the script

make

Load

Date as currentdate,

peek(Date) as previousdate

From xxx.qvd;

And use priviousdate in the chart to caculate

Not applicable
Author

Hi Rishi,

Thanks for your reply.

I implemented the peak function and it corrects returns the previous statement.

However, I am unable to use it in my expression.

I am using:

=Sum({$<StatementDate={$(=PreviousStatementDate)}>} Balance)

Please let me know if I am missing something.

Thanks,

WB

johnw
Champion III
Champion III

I can explain in more detail if needed, but this is probably the fifth time today I've suggested an AsOf table to solve similar problems, and I'm wearing out. Wink See attached solution. Hopefully it's what you're looking for.