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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Anonymous
Not applicable

Can you filter by the cell name in power query?

Hi guys,

can you filter by cell name in power query, for example A2? In my case I have a table with measured values, in one place a measured value is taken twice at different times, so you can't distinguish them only by the text. But the cell name was changed to C1f1 and C1f1_bi so that you can distinguish between the two. Now I wonder if I can filter by this name (unchanged would be A2 or A4). This is also a safer process because the cell name is not changed by accident. 
greetings Luke

1 ACCEPTED SOLUTION
v-xuding-msft
Community Support
Community Support

Hi @Anonymous ,

 

As Jimmy said, it is not supported for Power Query to filter by cell names. We can try to filter columns like below:

 

= Table.SelectRows(#"Changed Type", each Text.Contains([Name], "A"))

 

 

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTI0UIrViVZyAjFNwUxnENMYzHQBMc3BTFcg08gQzHQDMU3ATLAJZkqxsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t, Values = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Values", Int64.Type}}),
    #"Filtered Rows" = Table.SelectRows(#"Changed Type", each Text.Contains([Name], "A"))
in
    #"Filtered Rows"

 

v-xuding-msft_0-1601617695226.pngv-xuding-msft_1-1601617709425.png

 

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

View solution in original post

2 REPLIES 2
v-xuding-msft
Community Support
Community Support

Hi @Anonymous ,

 

As Jimmy said, it is not supported for Power Query to filter by cell names. We can try to filter columns like below:

 

= Table.SelectRows(#"Changed Type", each Text.Contains([Name], "A"))

 

 

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTI0UIrViVZyAjFNwUxnENMYzHQBMc3BTFcg08gQzHQDMU3ATLAJZkqxsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t, Values = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Values", Int64.Type}}),
    #"Filtered Rows" = Table.SelectRows(#"Changed Type", each Text.Contains([Name], "A"))
in
    #"Filtered Rows"

 

v-xuding-msft_0-1601617695226.pngv-xuding-msft_1-1601617709425.png

 

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Jimmy801
Community Champion
Community Champion

Hello @Anonymous 

 

Power query is no spreadsheet :), it's working like a database. You can however reference columns and rows.

Check out this example... the {0} in my code is the name of the first column, the {1} is the second row.

After extracting the data of this "cell" you could use it as filter criteria on another step or another query

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WUtJRcjIEElAUqxOt5GiE4IOEYgE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [A = _t, B = _t, C = _t, D = _t, E = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"A", type text}, {"B", type text}, {"C", type text}, {"D", type text}, {"E", type text}}),
    ValueA2 = Table.Column(Source,Table.ColumnNames(Source){0}){1}
in
    ValueA2

 

 Copy paste this code to the advanced editor in a new blank query to see how the solution works.

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

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 FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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