Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have a column with Fiscal weeks in the from of string as in"FW39_2012"
and I need month and quarter from it.
Could you please help.
Regards,
Shruti
=MakeWeekDate(SubField('FW39_2012','_',2), TextBetween('FW39_2012','FW','_'))
It will depend when your fiscal year starts, but you could use something like
makedate(2012) + (39 * 7)
MONTH( makedate(2012) + (39 * 7))
'Q' & CEIL( MONTH( makedate(2012) + (39 * 7)) / 12) AS qtr
you would need to add an offset for the start of your fiscal year.
Try like:
Load
Month(Date) as Month,
'Q'&Ceil(Month(Date)/3) as Quarter; //Preceding load
Load
MakeWeekdate(SubField([Fiscal Week], '_',2), PurgeChar(SubField([Fiscal Week], '_',1),'FW')) as Date
From <>;
The Qtr should be divided by 3 not 12!
'Q' & CEIL( MONTH( makedate(2012) + (39 * 7)) / 3) AS qtr
=MakeWeekDate(SubField('FW39_2012','_',2), TextBetween('FW39_2012','FW','_'))
Month(MakeWeekDate(SubField('FW39_2012','_',2), TextBetween('FW39_2012','FW','_'))) as Month
'Q'&Ceil(Month(MakeWeekDate(SubField('FW39_2012','_',2), TextBetween('FW39_2012','FW','_')))/3) as Quarter
Thanks All.
That worked like magic.
You're welcome
Regards
Marco