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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Power Query Editor - filter a query column based on another query column

I have the following situation:

One Date table with that includes information until the last date included in the SQL.

Google Analytics connection that includes Google Adwords Costs until the very moment the report is refreshed.

 

What I want to do: remove the days that are not covered in SQL (Date table) from the Google Adwords Costs.

I know that it can be done by using relationships, I know it can be done by using some merge transformations but due to the data model and other later merge operations I can not use that.

 

Is there any way to filter a column in a table in Power Query Editor based on a column in another table?

 

I attach a sample file here:

https://drive.google.com/file/d/13DSn7o8YSjLbaX4LVGL948qeWhEN0nHB/view?usp=sharing

 

This is the desired result in the sample file, eliminate every date after the MaxDate:

adriansuteu933_0-1623052103929.png

 

 

Thank you!

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

= let max =MaxDate[MaxDate]{0} in Table.SelectRows(#"Changed Type", each [Date] <= max)

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

2 REPLIES 2
CNENFRNL
Community Champion
Community Champion

= let max =MaxDate[MaxDate]{0} in Table.SelectRows(#"Changed Type", each [Date] <= max)

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Anonymous
Not applicable

Thank you @CNENFRNL !

It worked.

 

Full syntax used:

let
max =MaxDate[MaxDate]{0},
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("NcjBCQAgDAPAXfIWtLVWnEW6/xoiJPe8e5Hdug83NBiq/XBFMKZiMkKRjKVwRioOYys2qh4=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, Value = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Value", Int64.Type}}),
#"Filtered Rows" = Table.SelectRows(#"Changed Type", each [Date] <= max)

in
#"Filtered Rows"

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.