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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

How to filter a Table Column by values of an adjacent column

I have a table like this, with a Table type column.

PowerBoy_0-1617374778851.png

I want to filter the content of each row of this Table Column using values from other columns of the same row of the main table. 


Specifically I want to use the values of FirstLogin to filter the content of the AddIndex tables,  using the column SessionStart.

I thought using Table.SelectRows but it seems that it doesn't differentiate well columns of the main table from the embedded-table.  

Table.SelectRows([AddIndex], each [SessionStart] > _[FirstLogin])

PowerBoy_0-1617376592464.png

 


I would appreciate any idea. Thanks. 

 



1 ACCEPTED SOLUTION
edhans
Super User
Super User

You need to use a variable @Anonymous 

See this example how to do this:

 

2021-04-02_17-13-49.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bdFJCsQwDETRu3gdiEqOp2UPtwi5/zXigCWqGy20+dgPD+eZsGNXUUlbes1p6dqeqBbfc/qK2eJnDmTVw+qX9hdG64qVUVvZQrQz6nWwWlaEMOsV7HpVdr1mdofVg12vJTwvKsN2YbToGdDDAw+G/R8kchWRqz+f5jX/udcN", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, Code = _t, Amount = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Amount", Int64.Type}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Code"}, {{"MaxDate", each List.Max([Date]), type nullable date}, {"AllRows", each _, type table [Date=nullable date, Code=nullable text, Amount=nullable number]}}),
    #"Added Custom" = 
        Table.AddColumn(
            #"Grouped Rows", 
            "Max Value",
            each
                let
                    varDate = [MaxDate]
                in
                Table.SelectRows([AllRows], each [Date] = varDate)[Amount]{0})
in
    #"Added Custom"

 

How to use M code provided in a blank query:
1) In Power Query, select New Source, then Blank Query
2) On the Home ribbon, select "Advanced Editor" button
3) Remove everything you see, then paste the M code I've given you in that box.
4) Press Done
5) See this article if you need help using this M code in your model.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

1 REPLY 1
edhans
Super User
Super User

You need to use a variable @Anonymous 

See this example how to do this:

 

2021-04-02_17-13-49.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bdFJCsQwDETRu3gdiEqOp2UPtwi5/zXigCWqGy20+dgPD+eZsGNXUUlbes1p6dqeqBbfc/qK2eJnDmTVw+qX9hdG64qVUVvZQrQz6nWwWlaEMOsV7HpVdr1mdofVg12vJTwvKsN2YbToGdDDAw+G/R8kchWRqz+f5jX/udcN", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, Code = _t, Amount = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Amount", Int64.Type}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Code"}, {{"MaxDate", each List.Max([Date]), type nullable date}, {"AllRows", each _, type table [Date=nullable date, Code=nullable text, Amount=nullable number]}}),
    #"Added Custom" = 
        Table.AddColumn(
            #"Grouped Rows", 
            "Max Value",
            each
                let
                    varDate = [MaxDate]
                in
                Table.SelectRows([AllRows], each [Date] = varDate)[Amount]{0})
in
    #"Added Custom"

 

How to use M code provided in a blank query:
1) In Power Query, select New Source, then Blank Query
2) On the Home ribbon, select "Advanced Editor" button
3) Remove everything you see, then paste the M code I've given you in that box.
4) Press Done
5) See this article if you need help using this M code in your model.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors