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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Using an expression within Set Analysis

Hello,

I am trying to use an expression within a set analysis, but I cannot make it work.

I have an expression called Lost_Minutes which is calculated as follows: 

 

=SUM(th_late_st)
+SUM(th_early_fin)

I would then like to use this expression in a set analysis in the same chart, so that I can count the number of times (using the th_ses_id field) the result in the Lost Minutes expression is greater than 90.

 

=COUNT({<[Lost_Minutes]={">90"}>}th_ses_id)

However, this returns a count total of all possible values, instead of limiting it to just those where the Lost Minutes are greater than 90.

When I replace the Lost_Minutes expression with a dimension, as below, it works correctly.

 

=COUNT({<[th_early_fin]={">90"}>}th_ses_id)

Is it possible to use the Lost_Minutes expression in the set analysis, and if so, what am I doing wrong?

Thanks,

Paul

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

You can't use an expression label in a set expression. What you can do is to use an expression in the search clause as per Massimo's example.

=Sum({<[Session ID] = {"=([Late Start (Calculation)]+[Early Finish (Calculation)]) > 90"}>}

[Late Start (Calculation)]+[Early Finish (Calculation)])

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

4 Replies
maxgro
MVP
MVP

this is an example

sum({$<product={"=(sum(v)+sum(z))>47000"}>} v)

1.png

try to adapt to your question or post some data

Preparing examples for Upload - Reduction and Data Scrambling

Anonymous
Not applicable
Author

Hello,

Thanks - I have attached an example.

In the top table, the Lost_Minutes expression is working correctly.

In the bottom table, I have used the label of this expression in a second expression, called Lost Minutes >90. I would like this to count the number of occasions that the Lost Minutes in a session is greater than 90 minutes. However, at the moment, it is is counting all sessions, and not applying the >90 minutes condition.

Thanks,

Paul

jonathandienst
Partner - Champion III
Partner - Champion III

You can't use an expression label in a set expression. What you can do is to use an expression in the search clause as per Massimo's example.

=Sum({<[Session ID] = {"=([Late Start (Calculation)]+[Early Finish (Calculation)]) > 90"}>}

[Late Start (Calculation)]+[Early Finish (Calculation)])

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anonymous
Not applicable
Author

Thanks - this worked as I had hoped.

Thanks both.