Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Support Cases coming to Qlik Community Oct. 4! Start chats, open cases, explore resources: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
amazon_mckenzie
Contributor II
Contributor II

Variables, Scenario Analysis, and Expressions?

Hello!

I'm working to do some scenario analysis and can't figure out how to do what I need!

Imagine the following simple data set:

DocumentNumDate 1Date 2Amount

1

3-10-163-15-16100
23-15-163-18-16150
32-15-162-10-16200
42-25-162-20-16125
51-25-162-20-1650

I want a result returned to me that adds up all of the amounts where Date 1 is less than or equal to Date 2 for whatever my selection is. So, I have been using:

=sum({1<[DocumentNum]={"=([Date 1]<=[Date 2])"}>}Amount)

This seems to work just fine- in the data set above, this gives a total of 300 from items1,2,5.

But now, I want to allow the user the ability to enter in a number of days to add on to Date 1, and then calculate a new total. I set up an input box with a variable: v_days.

What I want my formula now to do add up all of the amounts where (Date 1 + v_days) is less than or equal to Date 2. If I entered 4 as v_days, this should give me a total of 150 (from items1,5). If I entered 10 as v_days, this should give me a total of 50 (just item 5 now works).

But I can't seem to get this formula right- help!

1 Solution

Accepted Solutions
sunny_talwar

This seems to be working:

=Sum({1<[DocumentNum]={"=(([Date 1] + $(v_Days))<=[Date 2])"}>}Amount)

View solution in original post

2 Replies
sunny_talwar

This seems to be working:

=Sum({1<[DocumentNum]={"=(([Date 1] + $(v_Days))<=[Date 2])"}>}Amount)

View solution in original post

amazon_mckenzie
Contributor II
Contributor II
Author

Amazing! Thank you so much. Why could I not do that on my own???