Discussion Board for collaboration on QlikView Scripting.
How can I modify the usual script method for defining quarters (below) so that it works when the first quarter starts in March? (ie Jan and Feb are Q4?)
RecNo() as Month,
'Q' & ceil(recno()/3) as Quarter
Wondering if there is a quick workaround just by defining a map so that I list 1 = Q4, 2= Q4, 3=Q1, 4= Q1 etc, but I can't find the syntax.
Any help much appreciated
Go to Solution.
You can use the method mentioned in attached sample application.
LOAD * INLINE
LOAD RecNo() AS Mth,
ApplyMap('QuartersMap',RecNo()) AS Qtr
The other programatic way is below:
Pick(Match(RecNo(),1,2,3,4,5,6,7,8,9,10,11,12), 4,4,1,1,1,2,2,2,3,3,3,4) AS Qtr
Please revert back for any further query.
Well, if you like to use something like a lookup or mapping, you could probably do
'Q' & pick(recno(),4,4,4,1,1,1,2,2,2,3,3,3) as Quarter
or maybe without a lookup
'Q' & if( ceil(recno()/3)-1=0,4,ceil(recno()/3) ) as Quarter
Hope this helps,
Many thanks for your help - Robert
Great – thanks for your held Dhannanjay
Thanks for your help Swuehl