Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
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
ashfaq_haseeb
Champion III
Champion III

hi,

try below

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

Regards

ASHFAQ

Not applicable
Author

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

SunilChauhan
Champion II
Champion II

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

Sunil Chauhan
Not applicable
Author

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
Specialist
Specialist

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
Author

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
Specialist
Specialist

So, it's the opposite?

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

Regards,

Vincent