Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
cklimmer
Contributor

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
MVP & Luminary
MVP & Luminary

Re: Calculation of specific quarter dates

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

- Marcus

2 Replies
MVP & Luminary
MVP & Luminary

Re: Calculation of specific quarter dates

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

- Marcus

cklimmer
Contributor

Re: Calculation of specific quarter dates

Many thanks Marcus,

The solution works perfect!

Best regards,

Claus