Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be 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

Reply
Buckley
New Member

Change all dates in column to null

Hi all, hope you can help!

 

I need to remove all dates within the below column. The idea is, that if I can remove the dates I can then pivot the column out to produce new columns for each text string. 

 

I tired to replace values using the wild card **/**/*** & ??/??/???? but with no effect. I've also tried this while the data type has been switched to "date". Also with no effect?

 

Any help you could give would be appreciated!

 

 

Buckley_1-1708961561670.png

 

 

2 ACCEPTED SOLUTIONS
Vijay_A_Verma
Super User
Super User

Use this as your next step to replace date with null

Table.ReplaceValue(Source, each [WFM Activity], each if (Value.Is([a = Text.Split([WFM Activity],"/"), d = #date(Number.From(a{2}), Number.From(a{1}), Number.From(a{0}))][d], type date)) then null else [WFM Activity], Replacer.ReplaceValue, {"WFM Activity"})

 

View solution in original post

dufoq3
Super User
Super User

Hi @Buckley, what about this?

dufoq3_0-1709217319837.png

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WUorVgRIGxvoGhvpGBkYmYG5IamKuglNRZmoaRNYERdYltSw1J78gNzWvRCEkMzcVLOibmlqSmZcOZhuaItTHAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"WFM Activity" = _t]),
    Replace = Table.ReplaceValue(Source,
     null,
     null,
     (x,y,z)=> if (try Date.From(x, "sk-SK") otherwise x) is date or Text.Trim(x) = "" then null else x, //you can delete    or Text.Trim(x) = ""   if you want to replace only dates
     {"WFM Activity"} )
in
    Replace

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

View solution in original post

2 REPLIES 2
dufoq3
Super User
Super User

Hi @Buckley, what about this?

dufoq3_0-1709217319837.png

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WUorVgRIGxvoGhvpGBkYmYG5IamKuglNRZmoaRNYERdYltSw1J78gNzWvRCEkMzcVLOibmlqSmZcOZhuaItTHAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"WFM Activity" = _t]),
    Replace = Table.ReplaceValue(Source,
     null,
     null,
     (x,y,z)=> if (try Date.From(x, "sk-SK") otherwise x) is date or Text.Trim(x) = "" then null else x, //you can delete    or Text.Trim(x) = ""   if you want to replace only dates
     {"WFM Activity"} )
in
    Replace

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Vijay_A_Verma
Super User
Super User

Use this as your next step to replace date with null

Table.ReplaceValue(Source, each [WFM Activity], each if (Value.Is([a = Text.Split([WFM Activity],"/"), d = #date(Number.From(a{2}), Number.From(a{1}), Number.From(a{0}))][d], type date)) then null else [WFM Activity], Replacer.ReplaceValue, {"WFM Activity"})

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.