Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
aanndalia
Contributor
Contributor

How to filter one dimension by a condition involving multiple other fields

Hi, 

In QlikView v12, I have an example data set below where I am trying to show the the temperature curve for each place on a specific date where the humidity at a specific time is greater than a specific value. The x-axis is Time and y-axis is Temp and there can be multiple lines corresponding to different Place(s). 

For example, one scenario is I may want to see the temperature curve on 3/11/2019 for each place where the humidity is greater than 60 at Time = 7. So in the sample dataset below, I would want it to show the curve for NYC and CHI since those have humidity > 60 at time = 7 on 3/11/2019. The minimum humidity and time conditions are both variables in the qlikview app (vMinHumidity and vTimeOfHumidity). 

My problem is i'm not sure how to do this without losing any data points where the humidity is too low and being able to view a whole curve. My original thought is to create a Calculated dimension for the Place in the Dimensions tab to somehow only display the Place if these conditions are met, but I'm not sure the expression to use to get it to work this way.

The qvw file is attached with the data hardcoded in the script and a simple graph that I would want to modify to behave according to what I explained.

Any help is appreciated!

Data Set:

Place,Day,Time,Temp,Humidity
NYC,3/11/2019,7,43,84
NYC,3/11/2019,15,61,53
NYC,3/11/2019,23,60,56
NYC,3/12/2019,7,55,81
NYC,3/12/2019,15,64,42
NYC,3/12/2019,23,58,56
NYC,3/13/2019,7,40,89
NYC,3/13/2019,15,42,73
NYC,3/13/2019,23,43,77
LA,3/11/2019,7,54,56
LA,3/11/2019,15,62,42
LA,3/11/2019,23,60,50
LA,3/12/2019,7,58,61
LA,3/12/2019,15,66,42
LA,3/12/2019,23,63,43
LA,3/13/2019,7,61,49
LA,3/13/2019,15,62,39
LA,3/13/2019,23,55,42
CHI,3/11/2019,7,27,65
CHI,3/11/2019,15,42,42
CHI,3/11/2019,23,40,57
CHI,3/12/2019,7,32,61
CHI,3/12/2019,15,34,31
CHI,3/12/2019,23,25,44
CHI,3/13/2019,7,20,51
CHI,3/13/2019,15,24,43
CHI,3/13/2019,23,24,49

Labels (1)
4 Replies
qliksus
Specialist II
Specialist II

Your requirement is simple and can be achived by a normal set expression
sum({<Humidity={">$(vMinHumidity)"}>}Temp) . But the question is why do you want to filter a data and still want to show all the data ?? A better way of analysis can be achieved by having the humidty in a grouped format like 10-20 ,20-30,40-50 using the class function .
aanndalia
Contributor
Contributor
Author

I appreciate the answer.

I think that solves another issue, not what I am trying to achieve exactly (probably my fault for not being clear). That expression will show all datapoints that are above the min humidity. To simplify things, I think my focus is really on the second paragraph in my initial post

For example, one scenario is I may want to see the temperature curve on 3/11/2019 for each place where the humidity is greater than 60 at Time = 7. So in the sample dataset below, I would want it to show the curve for NYC and CHI since those have humidity > 60 at time = 7 on 3/11/2019. The minimum humidity and time conditions are both variables in the qlikview app (vMinHumidity and vTimeOfHumidity). 

I reattached the qvw file to include a table of the data so it might be easier to see. There are 2 variables vMinHumidity and vTimeOfHumidity. I want to see the *whole* temperature curve for a Place when the Humidity > vMinHumidity at Time = vTimeOfHumidity on a particular day. The variables act as a filter to exclude curves where this condition is not met. Day is a dimension and the chart only shows data for one day (multi-select is disabled in the listbox).  In the qvw file, the chart I have right now should exclude the "LA" curve since the Humidity is 56 (less than 60) at Time=7, but I'm not sure what expression to use to get that to work.

qliksus
Specialist II
Specialist II

You have to make Place as your first dimension and time as second and use the below expression
sum({<Time={$(vTimeOfHumidity)}, Humidity={">$(vMinHumidity)"}>}Temp)
aanndalia
Contributor
Contributor
Author

I tried that, but it puts Place on the x-axis instead of Time. I still want to see Temp (y-axis) vs Time (x-axis) and each line should be a different Place. Basically I would expect the output chart to look exactly the same for the filters in my qvw example (vMinHumidity = 60, vTimeOfHumidity = 7, Day = 3/11/2019) except the "LA" line would not be there since it does not meet the criteria. Thanks