Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
ValeriaBonini
Partner - Creator
Partner - Creator

Master Calendar quarter names

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

Labels (3)
4 Replies
ggijben
Partner - Creator II
Partner - Creator II

Do you mean you want quarter names without the year? If so, you can try:

PurgeChar(QuarterName(MOVEMENTDATE),' 0123456789') as QuarterName2,
tresesco
MVP
MVP

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).

ValeriaBonini
Partner - Creator
Partner - Creator
Author

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: 

  • Q1
  • Q2
  • Q3
  • Q4

I would like to show: 

  •  january-march instead of Q1
  • april-june  instead ofQ2
  • july-september  instead ofQ3
  • october-december  instead of Q4
ValeriaBonini
Partner - Creator
Partner - Creator
Author

look at my comment below, i hope it is explained better