Forum Discussion
Copy only Date Values into New Column
I have a column which has dates and other values (answers to questions). Is it possible to create a new column only copying the date values and excluding the other data? If so, how can I do this?
Thank you in advanced.
Javier
Hi JCortez
You can create a new column in DAX that keeps only the date values and returns blank for anything else using this codeDateOnlyColumn =
IF (
ISBLANK([YourColumn]),
BLANK(),
IF (
NOT(ISERROR(DATEVALUE([YourColumn]))),
DATEVALUE([YourColumn]),
BLANK()
)
)Did it work? π A kudos would be appreciated
π¨ Mark it as a solution to help spread knowledge π‘Hi JCortez
Happy for you.
Did it work? π A kudos would be appreciated
π¨ Mark it as a solution to help spread knowledge π‘
9 Replies
- DataVitalizerSuper User
Hi JCortez
Could you provide a sample of your column data?Did it work? π A kudos would be appreciated
π¨ Mark it as a solution to help spread knowledge π‘- JCortezFrequent Visitor
I would like just the date values copied from the column named Response to the New Column Response (Copy). The non date values can be left blank.
- DataVitalizerSuper User
Hi JCortez
You can create a new column in DAX that keeps only the date values and returns blank for anything else using this codeDateOnlyColumn =
IF (
ISBLANK([YourColumn]),
BLANK(),
IF (
NOT(ISERROR(DATEVALUE([YourColumn]))),
DATEVALUE([YourColumn]),
BLANK()
)
)Did it work? π A kudos would be appreciated
π¨ Mark it as a solution to help spread knowledge π‘
- BmejiaSuper User
It would be good if yo provided a sample as Solution Sage mention as it may vary. You can use the Split Column option during the transformation process by highlighting the column and use some type of deliminator.
- JCortezFrequent Visitor
Sample provided.
- BmejiaSuper User
Can you add a conditional column that if you have a backlash / then it would select the date on new column. I understand you might have other text with / might have to add and additional logic if you do.