7 Replies Latest reply: Jun 30, 2014 10:40 AM by Vincent Ardiet

# 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)

Romain

• ###### Re: Remplacer un "if" par un set analysis

hi,

try below

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

Regards

ASHFAQ

• ###### Re: Remplacer un "if" par un set analysis

Hi,

For exemple :

 DAY FLAG CA

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

• ###### Re: Remplacer un "if" par un set analysis

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

• ###### Re: Remplacer un "if" par un set analysis
 DAY FLAG CA

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.

Romain

• ###### 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

• ###### 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.

• ###### Re: Remplacer un "if" par un set analysis

So, it's the opposite?

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

Regards,

Vincent