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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
tgarthaffner
New Member

Change random dates

I have a data set where there is a column with dates when a particular instance became ready for the next step. I want to convert any field in that column that has a date to read "INSTALL READY" instead. How can I accomplish this using power query. My conditional column and replace value attempts have failed. 

 

Some of the fields are also blank, and some have a zero as an entry. 

Thank you

2 REPLIES 2
ronrsnfld
Super User
Super User

You can use the Table.ReplaceValue function, but you need to write custom M code in the Advanced Editor:

Source Data

ronrsnfld_0-1768422457738.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtQ31TcyMDJVitWJVjIAk2DC0Ejf2BAkYwLmmugbmoN4FggVSIpN4YbEAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type any}}),
    
    #"Replace Dates" = Table.ReplaceValue(
        #"Changed Type",
        each [Date],
        "INSTALL READY",
        (x,y,z)=>if Value.Is(Date.From(y),type date) then z else y,
        {"Date"})
        
in
    #"Replace Dates"

Results

ronrsnfld_1-1768422490579.png

 

 

MasonMA
Community Champion
Community Champion

Hi, 

In Power Query, Add a Custom Column and update [Column] to your actual Column name, 

 

if Value.Is([Column], type date)
or Value.Is([Column], type datetime)
then "INSTALL READY"
else if [Column] = null or [Column] = 0
then null
else Text.From([Column])

MasonMA_0-1768417011950.png

 

Helpful resources

Announcements
December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.