Forum Discussion
Copy only Date Values into New Column
- 1 year ago
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 💡 - 1 year ago
Hi JCortez
Happy for you.
Did it work? 👍 A kudos would be appreciated
🟨 Mark it as a solution to help spread knowledge 💡
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 💡
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.
- DataVitalizer1 year agoSuper 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 💡- JCortez1 year agoFrequent Visitor
Thank you so much this worked.
- DataVitalizer1 year agoSuper User
Hi JCortez
Happy for you.
Did it work? 👍 A kudos would be appreciated
🟨 Mark it as a solution to help spread knowledge 💡
- Ashish_Mathur1 year agoSuper User
Hi,
This M code works
let Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content], #"Changed Type" = Table.TransformColumnTypes(Source,{{"Actual Field", type any}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if Value.Is([Actual Field], type datetime) then [Actual Field] else null) in #"Added Custom"Hope this helps.