Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

Remplacer un "if" par un set analysis

Hi everyone,

I’m trying to replace formula with « if » by set analysis

I have for an entity some days and each days are flagged « 0 » or « 1 ». If one of selected days is “1”, I will consider all selected days as “1”

Following formula with "IF" works :

=if(sum(FLAG)= 0, Sum(CaNetTtc_N),0)

Cela reviendrait a agréger une dimension dans le set analysis, ce qui ne fonctionne évidement pas :

That would be an aggregated dimension in the set analysis, which clearly does not work:

=sum({$<sum(FLAG)={0}>}CaNetTtc_N)

Thanks for your help

Romain

7 Replies

Re: Remplacer un "if" par un set analysis

hi,

try below

=sum({<FLAG={0}>} CaNetTtc_N)

Regards

ASHFAQ

Not applicable

Re: Remplacer un "if" par un set analysis

Hi,

thanks for your reply, i've already try this formula, and only display the days with 0.

For exemple :

   DAY  FLAGCA

28/06/2014  0    50

29/06/2014  0   100

30/06/2014  1   300

With =if(sum(FLAG)= 0, Sum(CaNetTtc_N),0) => 0 (Result is OK)

With =sum({<FLAG={0} CaNetTtc_N>})=> 150 (result KO)

If one selected day is flagged 1, i want to consider all selected days as 1 so the result would be = 0.

Romain

chauhans85
Esteemed Contributor

Re: Remplacer un "if" par un set analysis

sum({$<"=$(sum(FLAG))"={0}>}CaNetTtc_N)

Not applicable

Re: Remplacer un "if" par un set analysis

DAY  FLAGCA

28/06/2014  0    50

29/06/2014  0   100

30/06/2014  1   300

With =sum({$<"=$(sum(FLAG))"={0}>}CaNetTtc_N) => 450 (Result is KO)

I think, the formula doesn't work.

Thanks for your reply

Romain

vincent_ardiet
Contributor III

Re: Remplacer un "if" par un set analysis

Hi,

If I understand you want to obtain 0 if at least a flag is equal to zero?

In this case, have you try the following expression:

=min(FLAG)*sum(CaNetTtc_N)

Regards,

Vincent

Not applicable

Re: Remplacer un "if" par un set analysis

Sorry Vincent, i was wrong.

If one one day in my selection is flagged 1, i want to consider all selected days as 1 so the result would be = 0.

vincent_ardiet
Contributor III

Re: Remplacer un "if" par un set analysis

So, it's the opposite?

=(1-max(FLAG))*sum(CaNetTtc_N)

Regards,

Vincent


Community Browser