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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Qtrs map for Financial Year

Hi Guys,

I have created a Master calendar and everything works fine, however i realised that i need my Quarters to follow our financial Year rather than Jan to Dec

So i need to map Q1 to June, July August, Q2 to September etc

What is the best way of doing this,

See below load script

Thanks

Mike

QuartersMap:

MAPPING LOAD

rowno() as Month,

'Q' & Ceil (rowno()/3) as Quarter

AUTOGENERATE (12);

Temp:

Load

               min(CalendarDate) as minDate,

               max(CalendarDate) as maxDate

              

Resident FIGURES;

Let varMinDate = Num(Peek('minDate', 0, 'Temp'));

Let varMaxDate = Num(Peek('maxDate', 0, 'Temp'));

DROP Table Temp;

TempCalendar:

LOAD

               $(varMinDate) + Iterno()-1 As Num,

               Date($(varMinDate) + IterNo() - 1) as TempDate

               AutoGenerate 1 While $(varMinDate) + IterNo() -1 <= $(varMaxDate);

MasterCalendar:

Load

               TempDate AS CalendarDate,

               week(TempDate) As Week,

               YEAR(TempDate) As Year,

               Month(TempDate) As Month,

               Day(TempDate) As Day,

               YeartoDate(TempDate)*-1 as CurYTDFlag,

               YeartoDate(TempDate,-1)*-1 as LastYTDFlag,

               inyear(TempDate, Monthstart($(varMaxDate)),-1) as RC12,

               date(monthstart(TempDate), 'MMM-YYYY') as MonthYear,

               ApplyMap('QuartersMap', month(TempDate), Null()) as Quarter,

               Week(weekstart(TempDate)) & '-' & WeekYear(TempDate) as WeekYear,

               WeekDay(TempDate) as WeekDay

              

Resident TempCalendar

Order By TempDate ASC;

Drop Table TempCalendar;

Labels (1)
1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

I'd just use a simple mapping table:

FiscalQuartersMap:

MAPPING LOAD [

Month, FiscalQuarter

1,Q3

2,Q3

3,Q4

4,Q4

5,Q4

6,Q1

7,Q1

8,Q1

9,Q2

10,Q2

11,Q2

12,Q3

];

and an extra applymap:

ApplyMap('FiscalQuartersMap', month(TempDate), Null()) as FiscalQuarter,


talk is cheap, supply exceeds demand

View solution in original post

4 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

I'd just use a simple mapping table:

FiscalQuartersMap:

MAPPING LOAD [

Month, FiscalQuarter

1,Q3

2,Q3

3,Q4

4,Q4

5,Q4

6,Q1

7,Q1

8,Q1

9,Q2

10,Q2

11,Q2

12,Q3

];

and an extra applymap:

ApplyMap('FiscalQuartersMap', month(TempDate), Null()) as FiscalQuarter,


talk is cheap, supply exceeds demand
MayilVahanan
MVP
MVP

Hi

Try like this

'Q'&Ceil(Num(Month(MonthStart(Date, -5))) / 3) as FiscalQuarter

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Thank You both

I have now got to figure out how to set the finiancial year itself. I will probably ask this in another post.

We report June - end of May

Mike

Not applicable
Author

Hi,

Try these,

load date,

Year(date) as Year,

month(date) as Month,



if(num(Month(date)) >=4 and num(Month(date))<=6, 'Q1',//1st quarter starts from 4th month

if(num(Month(date)) >=7 and num(Month(date))<=9, 'Q2',//2nd quarter starts from 7th month


if(num(Month(date)) >=10 and num(Month(date))<=12, 'Q3',//3rd quarter starts from 10th month

if(num(Month(date)) >=1 and num(Month(date))<=3, 'Q4')))) as Quarter, //4th quarter starts from 1st month,  u can change the numbers to get fiscal calendar.

FROM



(
ooxml, embedded labels, table is Sheet1);