Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hi,
I have a barchart that has the dimension year. And I make a seleciton on year and month. for example i select the year 2010, 2011 and 2012 and the month Aug and Sep. ok...so far so good. In the year 2012 I only have data to today's date (example: 10.09.2012). I am comparing in the bar chart my sales and I would like to compare it like this:
2010: 01.08.2010-10.09.2010
2010: 01.08.2011-10.09.2011
2012: 01.08.2012-10.09.2012
but for now 2010 and 2011 sales are shown to the end of september. does anyone have an idea how to solve this problem??
regards,
MT
Well,
Use the same formula with -2 (two years back) as well:
=Sum({< Date = {"=InYearToDate(Date, Today(), 0)", "=InYearToDate(Date, Today(), -1)", "=InYearToDate(Date, Today(), -2)"} >} Value)
Hope that helps.
Miguel
Hi.
Post your expressions.
I guess, you have bounded only years and months but not days.
Hi,
You can use the functions InYearToDate() or YearToDate() in your master calendar to set the actual year to date period comparison. You can download this QlikView as a sample. You have another example on how to use the functions in this post.
Hope that helps.
Miguel
Migueal,
you examples do not work for me. Because I have in 2010 and 2011 data from 01.08.2010(11)-30.09.2010(11) so of course my sales are sumed for the whole 2 months but in 2012 of course i dont have two full months so if I compare these sales it is just wrong and I cant tell if the sales are going good or bad.
so in 2010 and 2011 my sales are also just allowed to sum up to the todays date meaning if today is the 10th then it sum up only to the 10th. so how is it possible to do that?
Hi,
Those examples do eaxctly that: given that the previous years month have the whole 30 days and as long as this year's month is only 10 days long, the function YearToDate() will create a flag so you can check only those days that correspond to the current year, and dynamically, meaning that in the reload you do tomorrow, this flag will be extended to the 11 day.
Please check carefully both the thread and the document for that. YearToDate() will return "true" if the date is between the first day of the year and today, regardless the year (it will work for 2010, 2011, 2000...)
All those functions will work in a set analysis, but will perform better off in the script.
Hope that helps.
Miguel
how can I use the inyeartodate() function in set anlysis because i cant create a flag??
Hi,
Use it like follows:
=Sum({< Date = {"=InYearToDate(Date, Today(), 0)", "=InYearToDate(Date, Today(), -1)"} >} Value)
Far more complex than using a simple 1 or 0 in the script as a flag field, and will perform much better with large datasets or complex objects.
Hope that helps.
Miguel
Thank you, it works perfect for the year 2011 and 2012 but not for the year 2010. What do I have to do to get some data for 2010??
regards,
MT
Well,
Use the same formula with -2 (two years back) as well:
=Sum({< Date = {"=InYearToDate(Date, Today(), 0)", "=InYearToDate(Date, Today(), -1)", "=InYearToDate(Date, Today(), -2)"} >} Value)
Hope that helps.
Miguel
Thank you, know I understand how this formula works.
regards,
MT