Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem with date quarter

Good morning. I use a standard calendar. I have two variables for the date StartDate and EndDate .I would like to pass a value to filter the date by pressing buttons. If quarter 1  always start from 1 January to 31 March, Quarter 2 is from April 1 to June 31, and so on.


What I want to realize, is that when you click the button the system took a year specified in the start date and is calculated quarterly by substituting the desired data in the start date and end date. That is, when you select the date starting 10/10/2015 and end date of 31/01/2016 when you click on the 1st quarter of the launch date would be to pass a value 01.01.2015 and end date 31/03/2016..

I am using code for calendar below.

tmpCalendars:

LOAD * Inline [

'Name','Given Name'

'Date','Date'

];

Let vLastRec = NoOfRows('tmpCalendars')-1;

For vIx=0 to vLastRec

  Let vFieldName = Peek('Name',vIx,'tmpCalendars');

  Let vSuffix = Peek('Given Name',vIx,'tmpCalendars');

  [Calendar $(vSuffix)]:

  LOAD

  Z_DATE as [$(vFieldName)],

  Year(Z_DATE) as [Year$(vSuffix)],

  Dual('Quarter '& Text(ceil(month(Z_DATE)/3)) ,  ceil(month(Z_DATE)/3)) as [Quarter $(vSuffix)],

  QuarterName(Z_DATE) as [КварталГод $(vSuffix)],

  Month(Z_DATE) as [Month$(vSuffix)],

  Date(MonthStart(Z_DATE), 'MMM-YYYY') as [DayYear $(vSuffix)],

  Day(Z_DATE) as [Day$(vSuffix)];

  LOAD

  FieldValue('$(vFieldName)',IterNO()) as Z_DATE

  AutoGenerate(1)

  While not IsNull(FieldValue('$(vFieldName)',IterNo()));

  NEXT vIx

  DROP TABLE tmpCalendars;

And for Start and End date trigger i use  ='>='&date(vD1Start) & '<='&date(vD1End)

Сообщение отредактировано: Ivan Kantemirov

1 Reply
Not applicable
Author

I have resolved my question using =Date(date([vDimYear]) +0)

Where vDimYear is year(vD1Start)