enricolas
11/16/2017 - 11:10 AM

Calendario

Calendario

Calendario = 
ADDCOLUMNS (
CALENDAR (DATE(YeaR(NOW())-5;Month(NOW());1); DATE(year(NOW());12;31));
"DateKey"; FORMAT ( [Date]; "YYYYMMDD" );
"Year"; YEAR ( [Date] );
"Month"; MONTH([Date]);
"Day"; Day([Date]);
"Quarter"; "Q" & FORMAT ( [Date]; "Q" );
"YearQuarter"; FORMAT ( [Date]; "YYYY" ) & "/Q" & FORMAT ( [Date]; "Q" );
"Monthnumber"; FORMAT ( [Date]; "MM" );
"MonthNameShort"; FORMAT ( [Date]; "mmm" );
"MonthNameLong"; FORMAT ( [Date]; "mmmm" );
"YearMonthnumber"; FORMAT ( [Date]; "YYYY/MM" );
"YearMonthShort"; FORMAT ( [Date]; "YYYY/mmm" );
"WeekDayNr"; WEEKDAY([Date]);
"WeekDay"; SWITCH(WEEKDAY([Date]);1; "Sun"; 2; "Mon"; 3; "Tue"; 4; "Wed"; 5; "Thu"; 6; "Fri"; 7; "Sat";"Unknown day" );
"DayOfWeekNumber"; WEEKDAY ( [Date] );
"DayOfWeek"; FORMAT ( [Date]; "dddd" );
"DayOfWeekShort"; FORMAT ( [Date]; "ddd" );
"IsWeekend"; IF(WEEKDAY([Date]) = 1 || WEEKDAY([Date])=7;TRUE();FALSE())
)