Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

date ranges

I have a table with products that has START_DATE and END_DATE fields. I also have many other related tables with the same START_DATE and END_DATE. I need to have an ability to filter and count my items depending on a specific Year and a specific Quarter. I am thinking to have in inline table that would identifies Years and Quarter(how?) and then link it somehow (how?) to the real tables. But I need to know that a chosen Year is inside of the range between START_DATE and END_DATE. Any Ideas how to do that?

Thanks a lot.



1 Solution

Accepted Solutions
6 Replies
Miguel_Angel_Baeyens

Hello,

Take a look at this file and see if that fits into your requirements. In short, I've used two slider objects one for the starting date the other for the end date, that store both values into variables. Then these variables are used in the expressions as a part of a set analysis.

Hope that helps.

Not applicable
Author

HI,

If you work into your code:

Year (***Yourdatefield***) AS Year,

Month

(***Yourdatefield***) AS Month, [\code]
Then you can define with an inline
month, Qtr
Jan,1,
Feb,1,
March,1,.....etc
Then you can use the Qtr and Year field as a selection. If you concatenate the year and qtr (201001,201002,201003....) then you can select more than one quarter over more than one year in your slections. Otherwise, if you select Q1 and 2009 &2010, You'll be selecting Q1 from both years.
- Ronnie

</body>
Not applicable
Author

Thank you. It is a big help. Still in my main table I have two fields Start_date and End_date. For instance start_date is 1/1/2007 and end date is 5/8/2008. When I need to know how many products were available on 2/2/2007 - I would need to include this in my count and filter product table as the 2/2/2007 is in the range. But if i need to know how many were available on 2/2/2010 I would not include this in the calculation

Thank you

Not applicable
Author

It looks to me that I would need to dynamically create a cross reference table between my product table and master calendar table. This new table would need to have an Product id and Master calendar id udder condition that the start date and end date of the product provide the range where a particular date from the master calendar falls into.

I think I have a good idea but do not know how to write it correctly. Thank you.

Not applicable
Author

Thank you for the links. I used the calendar and IntervalMatch to create a join table betwen calendar and my product table with the start and end dates.



IntervalMatch

( CalendarDate ) load startdate, enddate resident product;