- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dates in Set Analysis
Hi Everyone,
Greetings!
Recently i came across an old app where in set analysis
Start_Date = {">=$(=Date(Yearstart(Monthstart(Max(Date-0))),'YYYY/MM/DD'))<=$(=Date(Max(Date-0),'YYYY/MM/DD'))"}
is used.
I am puzzled with max(Date-0) in the expression, I checked it in a table's measure and found that it returns numeric value of max(Date).
I am still puzzled and want to know the other possible reasons of why this was used other than changing it to numeric value. Both Start_Date and Date fields have same format i.e YYYY/MM/DD.
Please share your suggestions and experiences.
- Tags:
- set analysis
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@anu wrote:
... other than changing it to numeric value
I would assume that the developer had a similar idea in mind, may be considering implicit type casting, however in qlik - it does not work that way. IMO, this '-0' is redundant. Also, monthstart() is another function redundant in this context.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Even the date() could be removed because the >= respectively <= forced a numerical comparison which means the format is irrelevant and also that yearstart() returned a timestamp and not a date and therefore it could be look like:
Start_Date = {">=$(=Yearstart(Max(Date)))<=$(=Max(Date))"}
- Marcus
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@anu wrote:
... other than changing it to numeric value
I would assume that the developer had a similar idea in mind, may be considering implicit type casting, however in qlik - it does not work that way. IMO, this '-0' is redundant. Also, monthstart() is another function redundant in this context.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
this could just be
Start_Date = {">=$(=Date(Yearstart(Max(Date)),'YYYY/MM/DD'))<=$(=Date(Max(Date),'YYYY/MM/DD'))"}
If a post helps to resolve your issue, please accept it as a Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Even the date() could be removed because the >= respectively <= forced a numerical comparison which means the format is irrelevant and also that yearstart() returned a timestamp and not a date and therefore it could be look like:
Start_Date = {">=$(=Yearstart(Max(Date)))<=$(=Max(Date))"}
- Marcus
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As Start_Date is without timestamp and app has 35M records, does using Yearstart() without Date() formatting can help in reducing calculation time.