March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello!
i have a column like follows:
6/12/2022 2:50:00 PM
6/12/2022 3:42:10 PM
6/12/2022 3:50:17 PM
6/13/2022 1:19:47 AM
6/13/2022 4:12:58 AM
...
I want to create a column which only has the date included:
6/12/2022
6/12/2022
6/12/2022
6/13/2022
6/13/2022
Which DAX Expression do I have to use?
Thanks! 🙂
Solved! Go to Solution.
Hi @Anonymous ,
The solution will depend on the data type of the column you're trying to create a calculated column from. If it is a date, you simpley use INT ( Table[Column] ) and format the new column as a date - INT for integer as a datetime is actually a whole number for the date and decimal for the time. Otherswise, if it is a text, the formula will be very simIlar as in Excel.
Date only =
VAR __SPACE =
FIND ( " ", 'Table'[Date and time] ) - 1 //find the position of space from the left then -1 to get the position before it
RETURN
VALUE ( LEFT ( 'Table'[Date and time], __SPACE ) )
//VALUE is for converting the text date to actual date
Proud to be a Super User!
Hi @Anonymous ,
Is your problem solved?? If so, Would you mind accept the helpful replies as solutions? Then we are able to close the thread. More people who have the same requirement will find the solution quickly and benefit here. Thank you.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
The solution will depend on the data type of the column you're trying to create a calculated column from. If it is a date, you simpley use INT ( Table[Column] ) and format the new column as a date - INT for integer as a datetime is actually a whole number for the date and decimal for the time. Otherswise, if it is a text, the formula will be very simIlar as in Excel.
Date only =
VAR __SPACE =
FIND ( " ", 'Table'[Date and time] ) - 1 //find the position of space from the left then -1 to get the position before it
RETURN
VALUE ( LEFT ( 'Table'[Date and time], __SPACE ) )
//VALUE is for converting the text date to actual date
Proud to be a Super User!
Exactly what I looked for.
But i get an error saying "An argument of function "FIND" hast the wrong data type or has an invalid value".
The used data type is "date/time". @danextian
FIND is a text function so if a data type other than text is used it will return an error. If you need to extract the date portion of a datetime, you can use INT() or DATE(YEAR(Table[DateTime]), MONTH (Table[DateTime]), DAY(Table[DateTime]) )
Proud to be a Super User!
As mentioned, the solution will depend on the data type. Is it a text or a datetime?
Proud to be a Super User!
@Anonymous Well, you could do this:
New Column = DATE(YEAR([Date]),MONTH([Date]),DAY([Date]))
User | Count |
---|---|
117 | |
77 | |
58 | |
52 | |
46 |
User | Count |
---|---|
171 | |
117 | |
63 | |
57 | |
51 |