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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
tgarthaffner
New Member

Change ANY date to Text

Good day. 

 

I have what seems to be a simple task but I cannot figure it out.

 

I have a list of dates when a task was completed. I do not want to list the date but simply an "X" to depict that the task was accomplished. So, I want to replace or transform ANY date in a column with the letter X, this can be another column if required. Please advise.

 

Thank you. 

1 ACCEPTED SOLUTION
dufoq3
Super User
Super User

Hi @tgarthaffner, replace yellow with your previous step reference and orange with column name where you want to replace dates.

 

dufoq3_0-1709572929773.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjLVNzDUNzIwMlGK1YlW8sxTCCjKTy9KLS4G840s9A2MENIhqcUlSrGxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    ReplaceDatesWithX = Table.ReplaceValue(Source,
     null,
     "X",
     (x,y,z)=> if (try Date.From(x) otherwise false) is date then z else x,
     {"Column1"} )
in
    ReplaceDatesWithX

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

3 REPLIES 3
dufoq3
Super User
Super User

Hi @tgarthaffner, replace yellow with your previous step reference and orange with column name where you want to replace dates.

 

dufoq3_0-1709572929773.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjLVNzDUNzIwMlGK1YlW8sxTCCjKTy9KLS4G840s9A2MENIhqcUlSrGxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    ReplaceDatesWithX = Table.ReplaceValue(Source,
     null,
     "X",
     (x,y,z)=> if (try Date.From(x) otherwise false) is date then z else x,
     {"Column1"} )
in
    ReplaceDatesWithX

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

You can also combine these two approaches, no need for a full (x,y,z)  function.  But you must specify the culture.

 

 

 

let
  Source = Table.FromRows(
    Json.Document(
      Binary.Decompress(
        Binary.FromText(
          "i45WMjLVNzDUNzIwMlGK1YlW8sxTCCjKTy9KLS4G840s9A2MENIhqcUlSrGxAA==", 
          BinaryEncoding.Base64
        ), 
        Compression.Deflate
      )
    )
  ), 
  #"Replaced Value" = Table.ReplaceValue(
    Source, 
    each [Column1], 
    each 
      if (try Value.Is(Date.From([Column1], "en-GB"), type date) otherwise false) then
        "X"
      else
        [Column1], 
    Replacer.ReplaceValue, 
    {"Column1"}
  )
in
  #"Replaced Value"

 

 

Anonymous
Not applicable

In a custom column, include

 

each if Value.Type([DateColumn]) = type date then "X" else null

 

--Nate

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.