Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
stefano_marson
Partner - Contributor II
Partner - Contributor II

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 II
Partner - Contributor II
Author

Thank you Christos , your reply is correct!