-
-
Save biliboss/7c2baf793a16373c8eabec9a8c9c6a97 to your computer and use it in GitHub Desktop.
Power BI | DAX Date Table
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_Date = | |
VAR BaseCalendar = CALENDARAUTO() | |
RETURN | |
GENERATE ( | |
BaseCalendar, | |
VAR BaseDate = [Date] | |
VAR DayNumber = Right(CONCATENATE("00",DAY ( BaseDate )),2) | |
VAR YearDate = YEAR ( BaseDate ) | |
VAR MonthNumber = Right(CONCATENATE("00",MONTH ( BaseDate )),2) | |
VAR JoinDate = CONCATENATE(01,CONCATENATE("/",CONCATENATE(MonthNumber,CONCATENATE("/",2018)))) | |
VAR MonthName = FORMAT ( BaseDate, "mmm") | |
VAR MonthFullName = FORMAT ( BaseDate, "mmmm") | |
VAR YearMonthName = FORMAT ( BaseDate, "yyyymmmm" ) | |
VAR YearMonthNumber = YearDate * 12 + MonthNumber - 1 | |
VAR Aging = TODAY() - BaseDate | |
RETURN ROW ( | |
"Join Date",JoinDate, | |
"Day", DayNumber, | |
"Year", YearDate, | |
"Month Number", MonthNumber, | |
"Month", MonthName, | |
"Month Full", MonthFullName, | |
"Year Month Number", YearMonthNumber, | |
"Year Month", YearMonthName, | |
"Aging", Aging | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment