Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

Indirect Set Analysis and Greater Than

Hello all.

Concept:

I have a document containing various information about clients, sales, etc.

As part of my load, I also have a separate data construct called protocols, which are not directly linked to clients/etc. but contain a set of metric definitions.

In this example, I am needing to pull all Clients from the current selection who have a Age within the bounds specified by ProtocolGroup_ID = 1.

The following expression works:

=count({$<ClientAge=P({1<ProtocolGroup_ID={'1'}>}AgeMin)>} DISTINCT ClientID)

The expression above works to provide a count of all Clients in current selection who have an age matching the AgeMin value designated by the ProtocolGroup_ID. I need it to provide a count of all Clients who have an age Greater Than or Equal to the AgeMin value.

I have been unable to get it working.

Any insight would be most appreciated.

Thank you in advance for your time and consideration.


1 Solution

Accepted Solutions
Not applicable

Indirect Set Analysis and Greater Than

=count({$<ClientAge = {">=$(=only({1<ProtocolGroup_ID={1}>} AgeMin))"} >} DISTINCT ClientId)

that should be correct, if the AgeMin is not a variable but a with same value of field or single value only

10 Replies

Indirect Set Analysis and Greater Than

Hi,

     Try with this expression..

         

     =count({$<ProtocolGroup_ID={'1'},ClientAge={"<=$(AgeMin)"}>} DISTINCT ClientID)

Hope this is your need

Celambarasan

Not applicable

Indirect Set Analysis and Greater Than

Hey Celambarasan.

Thanks for the help.

Unfortunately, that won't work because the ProtocolGroup_ID has nothing to do with the current selection.

If I use the expression you provided, I get the full count of Distinct ClientIDs in my selection, not restricted by age.

Not applicable

Indirect Set Analysis and Greater Than

Hi,

Try this! It should work, if I understood it correctly.

count(DISTINCT {<Age={"<=$(=max({<protocol={'g3'}>}agemin))"}>}ClientID)

...

Ashutosh

Not applicable

Indirect Set Analysis and Greater Than

just change field names according to your fields.

MVP
MVP

Indirect Set Analysis and Greater Than

So your AgeMin is an unambiguous single value? Maybe you could use

=count({$<ClientAge = {">=$(=only({1<ProtocolGroup_ID={1}>} AgeMin))"} >} DISTINCT ClientID)

Not applicable

Indirect Set Analysis and Greater Than

oh yes...I did not notice that he wanted greater than or equal to. So what i wrote earlier should be changed to 

count(DISTINCT {<Age={">=$(=max({<protocol={'g3'}>}agemin))"}>}ClientID)

or may be only can also be used but I will personally prefer max.


count(DISTINCT {<Age={">=$(=only({<protocol={'g3'}>}agemin))"}>}ClientID)

...

Thanks

Ashutosh

Not applicable

Indirect Set Analysis and Greater Than

Hi,

what i understood this may help you

let say between 1 to 12 :

=count({$<ClientAge=P({1<ProtocolGroup_ID={'>=1<=12'}>}AgeMin)>} DISTINCT ClientID)



====Else you can Create a Variable and pass instead of Numbers ==========================


=count({$<ClientAge=P({1<ProtocolGroup_ID={">=$(vMin) <=$(vMax)"}>}AgeMin)>} DISTINCT ClientID)


Not applicable

Indirect Set Analysis and Greater Than

=count({$<ClientAge = {">=$(=only({1<ProtocolGroup_ID={1}>} AgeMin))"} >} DISTINCT ClientId)

that should be correct, if the AgeMin is not a variable but a with same value of field or single value only

Not applicable

Indirect Set Analysis and Greater Than

Hey Dwi.

Your code is spot on and works great. Thanks!

What would I need to modify so that the count is for ClientAge >= AgeMin and ClientAge <= AgeMax?

Community Browser