Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Reg:Query on YTD

Hi All,

I am having a typical scenario for YTD.In that I am having entry for 365 days.So when I click current day

i have to see the values for past one year.

For Ex:

if I clicked 1st May 2009 ,in that case I have to get values from '5/01/2008' to '5/01/2009'

For more clarity I have attached qvw with this query.

If any one of you having faced same kind of issue please let me know the way 4 solve.

Thanks & Regards

Jai

1 Reply
Miguel_Angel_Baeyens

Hello Jai,

For what it's worth, it seems you don't really need an YTD analysis rather than a moving annual total or twelve months rolling date instead. YTD means (speaking with today's date) you want to analyze from "Ene 1 2009" to "Mar 8 2009" compared to "Ene 1 2010" to "Mar 8 2010" (today).

I'd use

AddMonths(DateField, -12)
in your script and expressions so you can select the last 12 months (i.e: from today's date minus one year to today's date or selected 01/03/2009, sum sales from 01/03/2008 to 01/03/2009). Your expression then should look like
Sum({< Date = {">=$(=AddMonths(Date, -12))<=$(VMax)"} >} Sales)