Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I need to know how quarters in a year will be calculated based on current date time and also based on date field from my database.
If I have a field of type date and need to calculate Quarters (Suppose Q1, Q2, Q3 and Q4), then how to do that thing?
try tis in ur script Date/calendar table.
'Q' & Ceil(Month([Order Date])/3) As Quarterly,
=Num(Ceil( Month(MyDate)/ 3 ), 'Q0')
use some thing like below as Mapping table :
QuartersMap:
MAPPING LOAD
rowno() as Month,
'Q' & Ceil (rowno()/3) as Quarter
AUTOGENERATE (12);
HI Try This
QuartersMap:
MAPPING LOAD
rowno() as Month,
'Q' & Ceil (rowno()/3) as Quarter
AUTOGENERATE (12);
MasterCalendar:
Load
TempDate AS DATE,
week(TempDate) As Week,
Year(TempDate) As Year,
Month(TempDate) As Month,
Day(TempDate) As Day,
date(monthstart(TempDate), 'MMM-YYYY') as MonthYear,
ApplyMap('QuartersMap', month(TempDate), Null()) as Quarter,
Year(TempDate) & ' ' & ApplyMap('QuartersMap', month(TempDate), Null()) as CalendarYearQuarter,
RIGHT(Year(TempDate) & ' ' & ApplyMap('QuartersMap', month(TempDate), Null()), 2) AS CalendarQuarter,
Week(weekstart(TempDate)) & '-' & WeekYear(TempDate) as WeekYear,
WeekDay(TempDate) as WeekDay
Resident TempCalendar
Order By TempDate ASC;
Drop Table TempCalendar;