Forum Discussion
JCortez
1 year agoFrequent Visitor
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? ...
- 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 💡
JCortez
1 year agoFrequent 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.
Ashish_Mathur
1 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.