Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Using input fields to select date range in set analysis


Hello QlikCommunity,

I'm having some issues setting a date range in the set analysis and could really use some help. We believe our issues are coming from the use of an input field(StartDate & EndDate) that is dynamically set by the user by location. We would like to analyze locations for different business divisions based upon the date range set by the user that typically corresponds to when a certain product mix was in stock. Each business division has it's own set of data so the date ranges/locations change and we reuse our .qvw for several business divisions and would like to expand to additional business divisions for which the locations and date ranges are currently unknown.

Here is what we have:

LocationStartDateEndDate

A

1/1/20133/20/2013
B1/1/20135/30/2013
C3/1/20135/30/2013
D3/15/20136/15/2013
E2/1/20133/20/2013

Here is what we have tried. These expressions have worked when all the start/end dates are the same, but when they are different they do not:

1) =Money(Sum({<[Snapshot Date]={'$(=(max([Snapshot Date])))'}, [Sales Date] = {">=$(=date(StartDate,'MM/DD/YYYY')) <=$(=date(EndDate,'MM/DD/YYYY'))"}>}
Sales), '$#,##0')

2) =Money(Sum({<[Snapshot Date]={'$(=(max(ALL [Snapshot Date])))'}, [Sales Date]={'>=$(StartDate)'}, [Salex Date]={'<=$(EndDate)'}>}

Sales), '$#,##0')

3) =Money(Sum({<[Snapshot Date]={'$(=(max([Snapshot Date])))'}, [Salex Date]={"=([Salex Date]>=StartDate)"}>*
<
[Snapshot Date]={'$(=(max([Snapshot Date])))'}, [Salex Date]={"=([Discharge Date]<=EndDate)"}>}

Sales), '$#,##0')

We have purposefully avoided using if statements because of how we treat null values. Does anyone have any other ideas on how we could make this work in the set analysis?

Your thoughts are much appreciated!

Thanks, Alex

3 Replies
Not applicable
Author

The 1) expression looks good to me. Can you remove the Snapshot Date filter and just keep the Sales Date filter for testing

Not applicable
Author

Hey Angad,

The Snapshot Date field did not have an impact in testing. Our charts with expression 1) were still blank... 😕

Alex

Gysbert_Wassenaar

A set analysis expression creates one set for the entire chart, not a set per row. It sounds like you want a set for each location. That would mean you can't use set analysis expressions. You'll have to use if statements I'm afraid.


talk is cheap, supply exceeds demand