Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

To group 4 month data into different cycles like C1,C2 and C3

Hi,

I am a new learner in qlikview. I am looking for inputs on grouping 4 month data.

For eg.

Jan, Feb, Mar and Apr will group into C1 cycle,

May, Jun, Jul and Aug will group into C2 cycle

Sep, Oct, Nov and Dec will group into C3 cycle

Could you please provide your inputs.

Thanks

1 Solution

Accepted Solutions
adamdavi3s
Master
Master

Where does your month field come from?

I suggest you use a master calendar and simply create this flag in there. Look at the way the Quarters are created and base it on that

MasterCalendar:

Load

TempDate AS OrderDate,

week(TempDate) As Week,

Year(TempDate) As Year,

Month(TempDate) As Month,

Day(TempDate) As Day,

'Q' & ceil(month(TempDate) / 3) AS Quarter,

'C' & ceil(month(TempDate) / 4) AS Cycle,

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

WeekDay(TempDate) as WeekDay

;

//=== Generate a temp table of dates ===

LOAD

date(mindate + IterNo()) AS TempDate

,maxdate // Used in InYearToDate() above, but not kept

WHILE mindate + IterNo() <= maxdate;

//=== Get min/max dates from Field ===/

LOAD

min(FieldValue('OrderDate', recno()))-1 as mindate,

max(FieldValue('OrderDate', recno())) as maxdate

AUTOGENERATE FieldValueCount('OrderDate')

View solution in original post

2 Replies
adamdavi3s
Master
Master

Where does your month field come from?

I suggest you use a master calendar and simply create this flag in there. Look at the way the Quarters are created and base it on that

MasterCalendar:

Load

TempDate AS OrderDate,

week(TempDate) As Week,

Year(TempDate) As Year,

Month(TempDate) As Month,

Day(TempDate) As Day,

'Q' & ceil(month(TempDate) / 3) AS Quarter,

'C' & ceil(month(TempDate) / 4) AS Cycle,

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

WeekDay(TempDate) as WeekDay

;

//=== Generate a temp table of dates ===

LOAD

date(mindate + IterNo()) AS TempDate

,maxdate // Used in InYearToDate() above, but not kept

WHILE mindate + IterNo() <= maxdate;

//=== Get min/max dates from Field ===/

LOAD

min(FieldValue('OrderDate', recno()))-1 as mindate,

max(FieldValue('OrderDate', recno())) as maxdate

AUTOGENERATE FieldValueCount('OrderDate')

Not applicable
Author

Thanks Adam for quick response. Above suggested thing works in my case.