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
powerbricco
Advocate I
Advocate I

PQ - Create a column if Source.name column begins with

Dear All,

i want to add a step in powerquery that creates a column only if Source.Name begins with letter "a".

Tha is beacuse my importing mode is changed. From now on, my Source.Name is different and the file is missing a column, so my transformations are messed up.

thank you a lot

1 ACCEPTED SOLUTION

You could add a query and make a list using Table.ColumnNames(QueryTableName), then make it a table, and then add extract the first letter of each column. Then you could make a reference query for the Table Query, and make a condition like if List.Contains(ColumnNameTable[ExtractedFirstLetterColumnName], {"a"}, then Do.YourTransformation, else Do.YourOtherTransformation.

 

You'll need to replace my table and column names to your own, but that's the idea.

 

--Nate

View solution in original post

3 REPLIES 3

You could add a query and make a list using Table.ColumnNames(QueryTableName), then make it a table, and then add extract the first letter of each column. Then you could make a reference query for the Table Query, and make a condition like if List.Contains(ColumnNameTable[ExtractedFirstLetterColumnName], {"a"}, then Do.YourTransformation, else Do.YourOtherTransformation.

 

You'll need to replace my table and column names to your own, but that's the idea.

 

--Nate

Natarajan_M
Solution Sage
Solution Sage

Hi @powerbricco , Could you please elaborate your requirement with some examples ?

Thanks 

Mauro89
Super User
Super User

Hi @powerbricco,

 

I thing this totally depends on the data source you are using and what is the "Source.Name" what you are looking for.

E.g. if you have a warehouse or lakehouse as source you can filter by the corresponding artefact (delta table, MV,...) in the "Navigation" steps when you add the data source.

 

Hope this helps to get into the right direction!

If not feel free to share a bit more content like data sources and PQ structure.

 

Best regards!

PS: If you find this post helpful consider leaving kudos or mark it as solution

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.