Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, i have created a master calendar:
Load *,
MonthName(MOVEMENTDATE) as MonthName,
QuarterName(MOVEMENTDATE) as QuarterName,
YearName(MOVEMENTDATE) as YearName,
'Quarter n.'&Ceil(Month(MOVEMENTDATE)/3) as Quarter,
Year(MOVEMENTDATE) as Year,
Month(MOVEMENTDATE) as Month,
WeekDay(MOVEMENTDATE) as WeekDay; //?
My question is: how can I create a Name for the 4 quarters?
I would like to have the list with: january-march, april-june, july-september, october-december
Do you mean you want quarter names without the year? If so, you can try:
PurgeChar(QuarterName(MOVEMENTDATE),' 0123456789') as QuarterName2,
Not sure if understood right. Quatername() gives output with MMM-MMM YY format. If you don't want to kkep the year part, you can always use left(..., 7).
This is my master-calendar code:
// 1. Extract the Minimum and Maximum dates from a date column in the fact table. From the existing table, you create min and max.
Min_Max:
Load
Min(MOVEMENTDATE) as MinDate,
Max(MOVEMENTDATE) as MaxDate
RESIDENT MAGAZZINO;
// 2. Populate all the dates between the min and max dates using peek function.
Let vMinDate = Peek('MinDate',0,'Min_Max'); // Peek(field_name[, row_no[, table_name ] ] )
Let vMaxDate = Peek('MaxDate',0,'Min_Max');
// Note: after that drop Min_Max temporary table.
// 3. Extract all the necessary date columns required for the dashboards
// Pulling dates between Min date and Max Date
Master_Calendar:
Load *,
MonthName(MOVEMENTDATE) as MonthName,
QuarterName(MOVEMENTDATE) as QuarterName,
YearName(MOVEMENTDATE) as YearName,
Ceil(Month(MOVEMENTDATE)/3) as Quarter,
Year(MOVEMENTDATE) as Year,
Month(MOVEMENTDATE) as Month,
WeekDay(MOVEMENTDATE) as WeekDay; //?
// 4. Associate the date column in the fact table to the date column in the master calendar.
Load
Date($(vMinDate) + IterNo() - 1) as MOVEMENTDATE
AutoGenerate 1
While $(vMinDate) + IterNo() - 1 <= $(vMaxDate);
//Dropping table
DROP TABLE Min_Max;
The output of the quarters section is:
I would like to show:
look at my comment below, i hope it is explained better