6 Replies Latest reply: Dec 10, 2012 5:55 AM by BRIJESH GADHESARIYA

# Condition on set Analysis

Hi,

I´ve this expression:

COUNT( {\$<NR_FATO={3}, CD_MOTIVO={10,31}>} CHAVE)

The dimension is a DATE. My trouble is, when DATE IS WEEKEND, i have tu use CD_MOTIVO={31}.

When DATE is a normal day (MOnday, Tuesday.... friday) i have to use CD_MOTIVO={10}.

Thank you

• ###### Re: Condition on set Analysis

Create a Field to denote a weekend flag and make expression as

Lets say If weekEnd then 1 else 0

COUNT( {\$<NR_FATO={3}, CD_MOTIVO={10}, IsWeekEnd={0}>+<NR_FATO={3}, CD_MOTIVO={31}, IsWeekEnd={1}>} CHAVE)

Hope it helps

Celambarasan

• ###### Re: Condition on set Analysis

HI

Try like this

=if(wildmatch(DATE,'Sunday','Ssaturday'),COUNT( {\$<NR_FATO={3}, CD_MOTIVO={10}>} CHAVE),COUNT( {\$<NR_FATO={3}, CD_MOTIVO={31}>} CHAVE))

or

if(Date = 'Sunday' or Date ='Saturday',COUNT( {\$<NR_FATO={3}, CD_MOTIVO={10}>} CHAVE),COUNT( {\$<NR_FATO={3}, CD_MOTIVO={31}>} CHAVE))

Hope it helps

• ###### Re: Condition on set Analysis

Hey Mayil,

i think in the meantime while i was writing the solution u had already posted

QV rocks !!!!

Regards

• ###### Re: Condition on set Analysis

Hi,

Try:

if(wildmatch(DATE,'sat*','sun*'),COUNT( {\$<NR_FATO={3}, CD_MOTIVO={31}>} CHAVE),

COUNT( {\$<NR_FATO={3}, CD_MOTIVO={10}>} CHAVE))

Regards

• ###### Re: Condition on set Analysis

Hi João,

I have an idea for you, you could make a verification for weekends like this:

```if(
WeekDay(DATE) = 5 or WeekDay(DATE) = 6,
COUNT( {\$<NR_FATO={3}, CD_MOTIVO={31}>} CHAVE),
0
)
+

if(
WeekDay(DATE) <> 5 and WeekDay(DATE) <> 6,
COUNT( {\$<NR_FATO={3}, CD_MOTIVO={10}>} CHAVE),
0
)

```

The values 5 and 6 are for Saturday and Sunday. I don't know if this is the best solution, probably not but may help you to workaround.

Regards,

Cesar Accardi

• ###### Re: Condition on set Analysis

Set a  variable weekEnd values 1 or 0

COUNT( {\$<NR_FATO={3}, CD_MOTIVO={10}, IsWeekEnd={0}>+<NR_FATO={3}, CD_MOTIVO={31}, IsWeekEnd={1}>} CHAVE)