Forum Discussion
Date Domension with DirectQuery connection
- 10 years ago
I had to make minor changes with quotations to have it work:
Date =
ADDCOLUMNS (
CALENDAR ( "1-jan-2000", "31-dec-2025" ),
"DateAsInteger", FORMAT ( [Date], "YYYYMMDD" ),
"Year", YEAR ( [Date] ),
"Monthnumber", FORMAT ( [Date], "MM" ),
"YearMonthnumber", FORMAT ( [Date], "YYYY/MM" ),
"YearMonthShort", FORMAT ( [Date], "YYYY/mmm" ),
"MonthNameShort", FORMAT ( [Date], "mmm" ),
"MonthNameLong", FORMAT ( [Date], "mmmm" ),
"DayOfWeekNumber", WEEKDAY ( [Date] ),
"DayOfWeek", FORMAT ( [Date], "dddd" ),
"DayOfWeekShort", FORMAT ( [Date], "dddd" ),
"Quarter", "Q" & FORMAT ( [Date], "Q" ),
"YearQuarter", FORMAT ( [Date], "YYYY" ) & "/Q" & FORMAT ( [Date], "Q" )
)
A calendar with only dates:
CalendarTable = CALENDAR("01/01/2015";"31/12/2015")
- Anonymous10 years agoNot applicable
iLikeAzureSQL Build it in your Azure SQL DB. There are a bunch of blogs out there that have the code and describe how to do this. Just as an example: https://sqldusty.com/2012/04/12/create-date-dimension-script/