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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Diego11
Frequent Visitor

Filter function in Power Query Editor

Hi everyone,

 

 I'm trying to filter a table in Power Query Editor by IDs that are in "Stage 3" but also show me their values from their previous stages. 

 

E.g.

 

Initial table 

IDStage Score
001150%
001230%
001370%
002115%
002227%
003110%
003266%
003330%
004110%
005126%
005237%

 

Filtered table

IDStage Score
001150%
001230%
001370%
003110%
003266%
003330%

 

I've tried but I only get values in Stage 3. Does anyone know how I can do it?

 

Thank you so much in advance,

1 ACCEPTED SOLUTION
tackytechtom
Most Valuable Professional
Most Valuable Professional

Hi @Diego11 ,

 

Before:

tackytechtom_1-1689649233950.png

 

 

After:

tackytechtom_0-1689649219148.png

 

 

Here the code in Power Query M that you can paste into the advanced editor (if you do not know, how to exactly do this, please check out this quick walkthrough)

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Zc6xDQAgCATAXUjsLBAEhzHuv4ZixGAsvrnweXoHxAIZLIIJRnahFX6EV9oVOq0iUXaaC/sNRrEb1Sj8bNWvJUdIo+wPbWtM", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, #"Stage " = _t, Score = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Stage ", Int64.Type}, {"Score", Percentage.Type}}),
    #"Filtered Rows" = Table.SelectRows(#"Changed Type", each ([#"Stage "] = 3)),
    #"Merged Queries" = Table.NestedJoin(#"Changed Type", {"ID"}, #"Filtered Rows", {"ID"}, "Filtered Rows", JoinKind.Inner),
    #"Removed Columns" = Table.RemoveColumns(#"Merged Queries",{"Filtered Rows"})
in
    #"Removed Columns"

 

Let me know, if this helps 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/

 



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

View solution in original post

2 REPLIES 2
tackytechtom
Most Valuable Professional
Most Valuable Professional

Hi @Diego11 ,

 

Before:

tackytechtom_1-1689649233950.png

 

 

After:

tackytechtom_0-1689649219148.png

 

 

Here the code in Power Query M that you can paste into the advanced editor (if you do not know, how to exactly do this, please check out this quick walkthrough)

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Zc6xDQAgCATAXUjsLBAEhzHuv4ZixGAsvrnweXoHxAIZLIIJRnahFX6EV9oVOq0iUXaaC/sNRrEb1Sj8bNWvJUdIo+wPbWtM", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, #"Stage " = _t, Score = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Stage ", Int64.Type}, {"Score", Percentage.Type}}),
    #"Filtered Rows" = Table.SelectRows(#"Changed Type", each ([#"Stage "] = 3)),
    #"Merged Queries" = Table.NestedJoin(#"Changed Type", {"ID"}, #"Filtered Rows", {"ID"}, "Filtered Rows", JoinKind.Inner),
    #"Removed Columns" = Table.RemoveColumns(#"Merged Queries",{"Filtered Rows"})
in
    #"Removed Columns"

 

Let me know, if this helps 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/

 



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Hi Tom.

 

 It worked. Thank you very much for your help 🙂

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.