1 Reply Latest reply: Feb 19, 2010 6:47 AM by Miguel Angel Baeyens de Arce

# Automatic Date-Limitation (max day = today....) by formula

Hello togehter,

i have the following question, i hope its understandable.

We have a formula to calculate the sales of a product in the chosen year -1 (you choose 2010 and it shows 2009 for comparing-purposes)

sum

({\$<invh_Year={\$(=only(invh_Year)-1)}>}(invd_units * prod_unit))

There is also the month and days chosable by listboxes.

Now we want this formula, to do the following: Show me the requested data for the chosen year -1, chosen months, selected days until today´s date.

So if we have Feb. 19.th 2010, the formula has to calculate till Feb. 19.th 2009 (without need to choose the day-range by a listbox).

Can you help me?

Thanks and regards!

• ###### Automatic Date-Limitation (max day = today....) by formula

Hello,

I would create a flag in your master calendar (click here among a lot of posts on how to create a master calendar) with all possible dates with YearToDate function something like

`YearToDate(DateField, -1) as LYFLag,`
. Then, adding this to the set analysis is pretty simple
`Sum({< LYFlag = {-1} >} invd_units * prod_unit)`
Hope this helps!