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

Share on Google Plus

About Tom DeMeulenaere

Highly accomplished information technology professional with extensive knowledge in System Center Configuration Manager, Windows Server, SharePoint, and Office 365.
    Blogger Comment

1 comments:

  1. I would like to thank the author for his useful and informative blog post about Power BI.

    Powerbi Read Rest

    ReplyDelete

Note: Only a member of this blog may post a comment.