Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Calculation of specific quarter dates

Hello,

I try to calculate specific quarter dates for a filter.

For example, if I run the report within the first 9 days of a quarter I want to filter automatically the previous quarter and from the 10th day the current quarter should be selected. I want to use this filter in NPrinting for a Report distribution...

I found already an example which is working almost as whished by selecting a specific date:

Ceil( Month( if(Day(DATE)>9,DATE,QuarterStart(DATE,-1)) )/3) as Quarter,

Or by selecting the current day:

Ceil( Month( if(Day(today())>9,today(),QuarterStart(today(),-1)) )/3) as TODAY_Quarter

The problem with these examples is, if I select e.g. the 8th May or the 8th June, the function is also selecting the previous quarter.

But I want only within the first 9 days of the quarter (e.g. from the 1st March until the 9th March) the previous quarter selected. From the 10th March until the quarter end (31th March) the current quarter should be selected.

Has anyone an idea?

Many thanks in advance and best regards,

Claus

1 Solution

Accepted Solutions
marcus_sommer

Try this: ceil(month(DATE - 9) / 3) as Quarter

- Marcus

View solution in original post

2 Replies
marcus_sommer

Try this: ceil(month(DATE - 9) / 3) as Quarter

- Marcus

Anonymous
Not applicable
Author

Many thanks Marcus,

The solution works perfect!

Best regards,

Claus