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

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

Reply
Anonymous
Not applicable

Filter Expression By Another Column

So I have a tabular model table expression, and I'm trying to filter rows based on a particular column in another expression/table.

 

I have a Date table that has rows for each date going back to 1980. I inherited this table so...go easy! I would like the expression to filter on a second table - DimSchedule. Ideally, I only want to populate the Date expression with dates that are inbetween the maximum and the minimum of the ActualScheduleDate column of the DimSchedule table.

 

Here is the current expression:

 

= Source{[Schema="common", Item="V_DimDate"]}[Data]

 

Thanks for any help!!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I managed to figure it out:

 

let
Source = Value.NativeQuery(#"SQL/azsds001d database windows net;EDW", "SELECT * FROM common.V_DimDate
WHERE [Date] <= (SELECT MAX(ScheduleDepartureDateZ)
FROM ops.DimFlightSchedule)
AND
[Date] >= (SELECT MIN(ScheduleDepartureDateZ)
FROM ops.DimFlightSchedule)")
in
Source

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

I managed to figure it out:

 

let
Source = Value.NativeQuery(#"SQL/azsds001d database windows net;EDW", "SELECT * FROM common.V_DimDate
WHERE [Date] <= (SELECT MAX(ScheduleDepartureDateZ)
FROM ops.DimFlightSchedule)
AND
[Date] >= (SELECT MIN(ScheduleDepartureDateZ)
FROM ops.DimFlightSchedule)")
in
Source

edhans
Super User
Super User

Hi @Anonymous - I am not 100% sure I am clear on what you want. Perhaps List.Contains() will work. It will filter one column on another within a Table.SelectRows() function. You can read my blog post about using it for this purpose here.

 

If that is not what you need, please be clearer with some sample data and expected output.

How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum



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
Anonymous
Not applicable

Thanks for you reply. I'm not actually trying to filter a column on another column. Essentially, I have an expression in a tabualr model that is being used as a date table. This expression as it exists today returns all rows from a view called v_DimDate. This result set is used a  tabualr model in SSAS. I don't want every row from this view. I only want rows where the Data column falls between the min and max of a differnt column from a different table.

 

Essentialy, this is the query if it were written in SQL

 

SELECT * FROM v_DimDate WHERE [Date] <= (SELECT MAX(ScheduleDate) FROM DimFlightSchedule) AND [Date] >= (SELECT MIN(ScheduleDate) FROM DimFlightSchedule)

 

I know SQL is nothing like DAX, but I'm fairly new to it, so still learning.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.