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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Select all columns starting with

Hi,

 

I want to select all the columns starting with a certain name. In this case: alarm. There are 200 columns starting with this -> alarm[001], alarm[002] etc. 

 

I now have: 
Select * FROM table

where column_name LIKE 'alarm%' 

 

It also isn't possible to say select alarm[001] , alarm[002] etc. Because the [ cause some kind of error. The error they give states that alarm can't be resolved. so it doens't take the [001] in account.

 

But that doesn't work. Anybody an idea?

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hey,

 

You can use the following Power M code to filter by rows beginning with "alarm".

 

    #"Filtered Rows" = Table.SelectRows(Source, each Text.StartsWith([ColumnName], "alarm"))

Kind regards,

Alex

View solution in original post

Zubair_Muhammad
Community Champion
Community Champion

@Anonymous 

 

I created a small illustrative example

Please see attached file's query editor for steps

 

First determine the Columns to Select using

 

=List.Select(Table.ColumnNames(#"Changed Type"),each Text.Contains(_,"alarm"))

 Then we can use

 

= Table.SelectColumns(#"Changed Type",ColumnsToSelect)

 


Regards
Zubair

Please try my custom visuals

View solution in original post

3 REPLIES 3
Sai_Alkesh
Helper II
Helper II

Thank you @Zubair_Muhammad . Worked perfectly for me.

 

thank you so very much.

Zubair_Muhammad
Community Champion
Community Champion

@Anonymous 

 

I created a small illustrative example

Please see attached file's query editor for steps

 

First determine the Columns to Select using

 

=List.Select(Table.ColumnNames(#"Changed Type"),each Text.Contains(_,"alarm"))

 Then we can use

 

= Table.SelectColumns(#"Changed Type",ColumnsToSelect)

 


Regards
Zubair

Please try my custom visuals
Anonymous
Not applicable

Hey,

 

You can use the following Power M code to filter by rows beginning with "alarm".

 

    #"Filtered Rows" = Table.SelectRows(Source, each Text.StartsWith([ColumnName], "alarm"))

Kind regards,

Alex

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors