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
itsmeanuj
Helper IV
Helper IV

Filter out Text in Date column

Hi,

 

I want to filter out all the values that do not look like dates in a column in Power Query. Here is the sample data.

 

N/A
6/1/2019
12/4/2018
7/1/2020
TBC
10/26/2021
Nov_18

 

In the above example, I want to filter out N/A, TBC, and NOV_18. is there an automated way to do that in power query? 

 

Regards,
Anuj

3 REPLIES 3
v-xinruzhu-msft
Community Support
Community Support

Hi @itsmeanuj 

You can put the following code to advanced editor in power query

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8tN3VIrViVYy0zfUNzIwtARzDI30TUA8CzDPHCxlZADmhDg5Q5QY6BuZgYQNwVy//LJ4kPJYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Value = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Value", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each try Value.Is(Date.FromText([Value]),type date) otherwise null),
    #"Filtered Rows" = Table.SelectRows(#"Added Custom", each ([Custom] = true)),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Custom"})
in
    #"Removed Columns"

Output

vxinruzhumsft_0-1703743420691.png

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Idrissshatila
Super User
Super User

Hello @itsmeanuj ,

 

you could remove it from power query by clicking the drop down arrow for the filtering and uncheck it. thus it won't show.



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




CoreyP
Solution Sage
Solution Sage

You could just change the data type to Date, then remove errors.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8tN3VIrViVYy0zfUNzIwtARzDI30TUA8CzDPHCxlZADmhDg5Q5QY6BuZgYQNwVy//LJ4kPJYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type date}}),
    #"Removed Errors" = Table.RemoveRowsWithErrors(#"Changed Type", {"Column1"})
in
    #"Removed Errors"

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.