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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
cool_333
Frequent Visitor

Power Query help replace date with zero or null

Hi all,

 

I was wondering if you gurus can help. I'm trying to replace all the different dates that appear in the value column with either 0 or null whichever works in the power query. Thank you in advance.

 

 

cool_333_0-1686247877221.png

 

1 REPLY 1
latimeria
Solution Specialist
Solution Specialist

Hi @cool_333 ,

 

Try this, using Table.TransformColumns:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("VZBLDsUgDAPvwjpS8wGSd5aK+1+jTwWp9tIzFii+76Z+aV6uHk1aVVvyZwHMquTgjniUxMYDsOvpTuxmytw46eUuvnFRO6Rv/AOcdv4zxfIXXmfojB1eCuF1dHGwo7M7u0GTsKMJJjva4QtrPQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, ValueIni = _t]),
    #"Added Custom" = Table.AddColumn(Source, "Value", each try Number.FromText([ValueIni]) otherwise Date.FromText([ValueIni])),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"ValueIni"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Removed Columns",{{"Date", type date}}),
    #"===Start here" = #"Changed Type",
    #"Replaced Date" = Table.TransformColumns(
        #"===Start here",
        {
            {"Value", each if Value.Is(_, Date.Type) then null else _ }
        }
    )
in
    #"Replaced Date"

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.