Forum Discussion
rohitchouhan
6 years agoFrequent Visitor
Adding a date column
I want to add a new column as a date index, which starts with 03 April 2018 or any particular date and goes on till the current date. how to add this thing through DAX as a column.I got some DAX exp...
stevedep
6 years agoMemorable Member
If you are looking to create a data table with an integer as your key. You perhaps don't need an index key. Just join on the date integer.
Date =
ADDCOLUMNS (
CALENDAR (DATE(2018;4;1); DATE(2025;12;31));
"DateAsInteger"; FORMAT ( [Date]; "YYYYMMDD" );
"Year"; YEAR ( [Date] );
"Monthnumber"; FORMAT ( [Date]; "MM" );
"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" )
)
Mind the data as integer colomn.
Please mark as solution if this helps you.
Kind regards,
Steve.
- rohitchouhan6 years agoFrequent Visitor
Hello, thanks for the prompt reply,
i just want to add a column in my current table which starts from a particular date and goes on till today's date.
just like the calendar.I used some DAX but all those creating a separate table, not adding column to expecting table