Forum Discussion
Matrix with Year and Month Column
- 1 year ago
Hi RichardsonMM ,
You can modify the DAX formula for your calendar table:
Calendar =
ADDCOLUMNS(
CALENDAR(DATE(2023,1,1), DATE(2025,12,31)),
"Year", YEAR([Date]),
"Month", MONTH([Date]),
"PeriodLabel",
IF(YEAR([Date]) < 2025,
FORMAT([Date], "yyyy"),
IF(MONTH([Date]) = 1, FORMAT([Date], "yyyy"), FORMAT([Date], "yyyy/mm"))
),
"PeriodSort",
IF(YEAR([Date]) < 2025,
YEAR([Date]) * 100,
IF(MONTH([Date]) = 1, YEAR([Date]) * 100, YEAR([Date]) * 100 + MONTH([Date]))
)
)
Hi RichardsonMM ,
You can modify the DAX formula for your calendar table:
Calendar =
ADDCOLUMNS(
CALENDAR(DATE(2023,1,1), DATE(2025,12,31)),
"Year", YEAR([Date]),
"Month", MONTH([Date]),
"PeriodLabel",
IF(YEAR([Date]) < 2025,
FORMAT([Date], "yyyy"),
IF(MONTH([Date]) = 1, FORMAT([Date], "yyyy"), FORMAT([Date], "yyyy/mm"))
),
"PeriodSort",
IF(YEAR([Date]) < 2025,
YEAR([Date]) * 100,
IF(MONTH([Date]) = 1, YEAR([Date]) * 100, YEAR([Date]) * 100 + MONTH([Date]))
)
)