-
Notifications
You must be signed in to change notification settings - Fork 0
/
dax-calendar-dax
33 lines (28 loc) · 1.09 KB
/
dax-calendar-dax
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Generazione Calendario automatico
// Codice DAX, tabella non persistente nel modello dati
// Paolo Falcone, Softing Consulting, Nov 2024 - Rev 2
DateTable =
ADDCOLUMNS (
CALENDARAUTO(),
"Year", YEAR([Date]),
"Year-Month", FORMAT([Date],"YYYY-MM"),
"Year-Quarter", FORMAT([Date], "YYYY \QTR-q"),
"Year-Quarter-short", YEAR([Date]) & QUARTER([Date]),
"Quarter", QUARTER([Date]),
"Quarter-No", QUARTER([Date]),
"Quarter-short", FORMAT([Date],"\QQ"),
"MonthNo", MONTH([Date]),
"Month", FORMAT([Date],"mmm"),
"Month-Name", FORMAT([Date], "MMMM"),
"Month-Number", MONTH([Date]),
"Month-short", LEFT( FORMAT( [Date], "mmm" ), 1) & REPT( UNICHAR ( 8203 ), MONTH( [Date] ) ),
"Month-Year", FORMAT([Date], "mmm YYYY"),
"Month-Year-short", FORMAT([Date], "YYYYMM"),
"Day", DAY([Date]),
"Weekday", WEEKDAY([Date]),
"Weekday-No", WEEKDAY([Date],2), //1-Sun..Sat, 2-Mon..Sat
"Weekday-short", FORMAT([Date],"ddd"),
"Weekday-Name", FORMAT([Date], "DDDD"),
"DateID", VALUE(FORMAT([Date], "YYYYMMDD")),
"DateKey", FORMAT([Date], "YYYYMMDD")
)