Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

eduardo_dimperi
Valued Contributor II

Set Analysis Issue

Hi,

I need to count all [DATA_LIMITE] that >= Today(), but my field are not in Date Format, so i tried with a more simple equacition (just equal), with "If "condition.

If (FLOOR([DATA_LIMITE])=FLOOR(TODAY()), TRUE,FALSE)

With this i got 'true' where need to be 'true', so i tried the same logic to set analysis and did not work like i expected.

I tried use that

COUNT(${<FLOOR(DATA_LIMITE)={"$(=FLOOR(TODAY()))"}>}DISTINCT OID_SYSTEM)


Thank you

1 Solution

Accepted Solutions
zebhashmi
Valued Contributor

Re: Set Analysis Issue

you are right but it will be inside of curly braces

14 Replies
MVP
MVP

Re: Set Analysis Issue

You cant put an expression on the LHS of a set expression qualifier

COUNT(${<FLOOR(DATA_LIMITE)={"$(=FLOOR(TODAY()))"}>}DISTINCT OID_SYSTEM)

So if DATA_LIMITE does not have a time component, then use

COUNT(${<DATA_LIMITE = {"$(=TODAY())"}>} DISTINCT OID_SYSTEM)

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

Re: Set Analysis Issue

Not sure when you say that your field is not in date format, but if your if statement works then maybe

COUNT(${<DATA_LIMITE={">=$(=FLOOR(TODAY()))"}>}DISTINCT OID_SYSTEM)


(you can't use an expression on the left hand side of the comparison in set analysis, only fields)

MVP
MVP

Re: Set Analysis Issue

If DATA_LIMIT does have a time component (generally not best practice), then you could use

COUNT(${<DATA_LIMITE = {">=$(=TODAY()) <$(=TODAY()+1)"}>} DISTINCT OID_SYSTEM)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
eduardo_dimperi
Valued Contributor II

Re: Set Analysis Issue

Hi Jonathan, Thank you for your time

Not work still bring all OID_SISTEM (204 Distinct Elements)

Here an image of my data

set_analysis.JPG

If your code my KPI results is 204, the same of Count(OID_SYSTEM)

eduardo_dimperi
Valued Contributor II

Re: Set Analysis Issue

Hi Piet!

Thanks for your explanation about can use an expression on left hand side, i didnt know about that.

About your response, the result are the same as Count(OID_SYSTEM) 204, but the right result are 3.

zebhashmi
Valued Contributor

Re: Set Analysis Issue

I would say

COUNT({$<P(FLOOR(DATA_LIMITE))={$(FLOOR(TODAY()))}>}DISTINCT OID_SYSTEM)

or

COUNT({$<DISTINCT OID_SYSTEM=P(FLOOR([DATA_LIMITE])=FLOOR(TODAY())>}DISTINCT OID_SYSTEM)

zebhashmi
Valued Contributor

Re: Set Analysis Issue

I see two problems in the code

1 $ would be inside the {} like {$<>}

second as Piet said we can't use the expression on the left side of set analyses. (I am not sure  with P() we can use or not so will give it a try and maybe you don't need "" and $ altogether)

Thanks

eduardo_dimperi
Valued Contributor II

Re: Set Analysis Issue

Hi Jahanzeb,

Not working too bro.

eduardo_dimperi
Valued Contributor II

Re: Set Analysis Issue

about the second problem you are right i didnt know about it, lesson to learn, about the first $ i believe that means the current selection, i could use $ or 1 or something like that

Community Browser