2 Replies Latest reply: Sep 28, 2012 8:15 AM by Stefan Wühl

# how to use date flags after you created the master calendar?

Hi,

This is a real beginner question.

I have made this standard master calendar (with date island, data variables and the calendar :

... Date... , Mindate, MaxDate.... then

Y AS Year,

M AS Month,

MY AS MonthYear,

num(MY) AS NumericMonthYear,

'Q' & ceil(M / 3) AS Quarter,

D as ...

Then afterwards you have all these CM, LY, YTD ... flags :

...

//Month flags

inmonth(D, \$(vToday), 0) * -1 AS CM,  //Current month

inmonth(D, \$(vToday), -1) * -1 AS PM,  //Previous month

...

This all works, but how do I use these flags now in my expression?

Let's say I have a field "Quantity", and I would like to see the tonnes for CM and PM in a table, how do I do this?

sum(if(CM=1,Quantity)) or something? I really don't know...

Thanks!!

• ###### Re: how to use date flags after you created the master calendar?

Try this expresion

sum({\$<[CM] = {0}>} Quantity)

• ###### Re: how to use date flags after you created the master calendar?

Essentially, yes, you could use

=sum(if(CM=1,Quantity))

You can also use

=sum(CM*Quantity)

if your flags are created using value 1 for true and 0 for false (like you did).

Instead of the first expression, you can also use a set expression:

=sum( {<CM={1}>} Quantity)

Hope this helps,

Stefan