Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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!

1 Reply
Miguel_Angel_Baeyens

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!