Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Error in expression - Set Analysis

Hello

I am getting the error  for the following Expression

Can you guys please help me to understand the reasons?

Unbenannt.JPG

I Need the no of Customers (KP.EMM-ID)

where the Booking Type = 'reward order' and the max no of orders <=3

Many thanks

Sonja

1 Solution

Accepted Solutions
sfatoux72
Partner - Specialist
Partner - Specialist

I think it's what you want (in orange).

2016-02-14 22_03_21-TestView_2.png

View solution in original post

10 Replies
petter
Partner - Champion III
Partner - Champion III

You can't have the expression like this:

$(dvRewOrders) <= {'3'}

Still is a valid syntax although It don't know if it will work for you:

aUniqueKey = {"=$(dvRewOrders)<=3"} 

but it also depends on the content of the variable dvRewOrders

Not applicable
Author

This Expression OK but the result '0'

=Count(Aggr(only( {<[C005.Booking Type.TEXT] = {'reward order'} count([C005.Booking ID]<='3')), [KP.EMM-ID]))

I Need the no of Customers (KP.EMM-ID)

where:

the Booking Type = 'reward order' and the max no of orders <=3

any ideas for my

thanks

sunny_talwar

Would you be able to share a sample to look at your datamodel?

Not applicable
Author

Attached you will find a sample with data

Many thanks

maxgro
MVP
MVP

maybe

=Count( {$ <[Customer-ID]={"=count({$ <[Booking Type]={'Reward Order 1'}>} [Booking ID])<=3"}>} distinct [Customer-ID])

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

If you are wondering what it means and how it works:

This is an Advanced Search criteria within the Set Analysis condition. Advanced Search (enclosed in double quotes and begins with the equals sign "=") allows evaluating ANY logical conditions in the context of the field. In this formula, the number of reward orders is evaluated for each Customer, and the result is compared to 3.

Come and learn advanced Set Analysis from my lecture at the Masters Summit for Qlik!

cheers,

Oleg Troyansky

sfatoux72
Partner - Specialist
Partner - Specialist

I think it's what you want (in orange).

2016-02-14 22_03_21-TestView_2.png

brijesh_fofadiy
Contributor III
Contributor III

First you have to create a variable to store no. of orders and after that You have to write like this :


count({$<[C005.Booking Type.TEXT] = {'reward order'},Orders={'<=$(dvRewOrders)'}>}[KP.EMM-ID])


It will run properly.


Thanks,

Brijesh

rajeshforqlikvi
Creator
Creator

$(dvRewOrders) = { < '3'}


Thanks & Regards

Rajesh Kumar