Nice Power BI Date table DAX expression
Many times you want to build your own date table in Power BI to show a date range. This is the DAX expression that I used to build that, which has a lot of options built into it:
Date =
ADDCOLUMNS (
CALENDAR (DATE(2019,1,1), DATE(2022,12,31)),
"DateAsInteger", FORMAT ( [Date], "YYYYMMDD" ),
"FullDate", FORMAT ( [Date], "dddd") & ", " & FORMAT ( [Date], "mmmm") & " " & FORMAT ( [Date], "dd") & ", " & FORMAT ( [Date], "yyyy"),
"Year", YEAR ( [Date] ),
"Monthnumber", FORMAT ( [Date], "MM" ),
"Day", FORMAT ( [Date], "DD"),
"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], "ddd" ),
"Quarter", "Q" & FORMAT ( [Date], "Q" ),
"YearQuarter", FORMAT ( [Date], "YYYY" ) & "/Q" & FORMAT ( [Date], "Q" )
)
This is an example of the table it builds:
Source: https://community.powerbi.com/t5/Desktop/IF-Date-in-field-is-later-than-today/td-p/304680
I would like to thank the author for his useful and informative blog post about Power BI.
ReplyDeletePowerbi Read Rest