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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
stefano_marson
Partner - Contributor III
Partner - Contributor III

set analysis with expression searches

Hello everybody,

I would like to write an expression that counts customers who placed orders worth more than 150 in a certain time frame.

I wrote this expression but it is wrong because the symbol " is repeated several times:


Sum({$< customer_id={"=Sum({$<OrderDate={">=$(=Date(vStartDate))<=$(=Date(vEndDate))"}>} Amount)>150"} >} oneCustomer)

What is the correct syntax to get the desired result?

Thanks in advance

Labels (1)
1 Solution

Accepted Solutions
ckarras22
Partner - Creator
Partner - Creator

Hello Stefano

You can escape the quotes by preceding with another qoute (below in red)

 

Sum({$< customer_id={"=Sum({$<OrderDate={"">=$(=Date(vStartDate))<=$(=Date(vEndDate))""}>} Amount)>150"} >} oneCustomer)

 

Christos K.

View solution in original post

3 Replies
ckarras22
Partner - Creator
Partner - Creator

Hello Stefano

You can escape the quotes by preceding with another qoute (below in red)

 

Sum({$< customer_id={"=Sum({$<OrderDate={"">=$(=Date(vStartDate))<=$(=Date(vEndDate))""}>} Amount)>150"} >} oneCustomer)

 

Christos K.

marcus_sommer

It's not a real set analysis else an if-loop and therefore it's better to apply a classical syntax instead of including it with a nested logic into the set analysis. This means something like this:

if(Sum({$<OrderDate={">=$(=Date(vStartDate))<=$(=Date(vEndDate))"}>} Amount)>150,
Sum(oneCustomer))

 

stefano_marson
Partner - Contributor III
Partner - Contributor III
Author

Thank you Christos , your reply is correct!