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: 
vroomloon
Contributor
Contributor

Set expression cannot be filtered by one specific listbox

The following set expression can be filtered by all of my list boxes except the one that contains the list of Tests. I’m brand new to Qlik, and have no coding skills to speak of; I imagine my error is a fundamental one. Any ideas?

 

=(

sum({$<Date = {'$(=Max(Date))’}>}[Test A]) +

sum({$<Date = {'$(=Max(Date))’}>}[Test B]) +

sum({$<Date = {'$(=Max(Date))’}>}[Test C]) 

-

sum({$<Date = {'$(=Min(Date))’}>}[Test X]) -

sum({$<Date = {'$(=Min(Date))’}>}[Test B]) -

sum({$<Date = {'$(=Min(Date))’}>}[Test C]) 

)

Labels (3)
4 Replies
Or
MVP
MVP

It seems like this expression adds/subtracts four different fields - Test A, Test B, Test C, and Test X. If there is some other field called Tests and containing the strings Test A, Test B, Test C, and Test X, there's no reason why that field would impact this expression (unless there's something a bit unusual with the data model).

vroomloon
Contributor
Contributor
Author

My mistake, "Test X" should be "Test A". 

I have a list of 100 students and a list of 10 tests and 5 years worth of scoring data for each student on each test. For my scatter plot 's default view, I want show each student's total score on all 10 tests over the full time period. The set expression accomplishes this, at least I think.

But for some reason my listbox that contains the list of each Test (Test A, Test B, etc.) cannot be used to filter/edit the chart, yet every other listbox (Date, Student Age, etc.) can.

Apologies in advance, I know I am out of my element here. 

Or
MVP
MVP

Again, a list of tests is not the same thing as Sum([Test A]). The latter is presumably a sum of a field called [Test A]. This field would not be impacted by the value 'Test A' in the field [Tests].

It sounds like you're perhaps trying to do something more along the lines of:

Sum({< Test *= {'Test A'} >} Score)

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

If you want ignore selections in a particular field, the set analysis syntax is

fieldname=

So if the field you want to ignore selections in is named "Tests", add to your expression like:

sum({$<Date = {'$(=Max(Date))’}, Tests=>}[Test A]) 

Also recommend you use RangeSum() instead of "+". "+' will make the entire result null if any of your sum() are null. RangeSum() will treat null as zero.

RangeSum(
sum({$<Date = {'$(=Max(Date))’}>}[Test A]),
sum({$<Date = {'$(=Max(Date))’}>}[Test B]),
sum({$<Date = {'$(=Max(Date))’}>}[Test C]) 
)

https://help.qlik.com/en-US/sense/May2023/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/RangeFunct...

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com