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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
tomperro
Helper V
Helper V

Dax Filter one table based on two columns of another table

I have two tables that have a relationship on Employee (EventTable filters TestsTable) but I also need to EventTable.Category to filter Category.TestsTable.


I need to show when the last Test in the same catgory was completed by each employee.


Example:  Tom has had 1 event in Category 1 (EventTable) and his last test in Category 1 was 12-31-2022 (TestsTable).

EventTable

DateEventIdEmployeeCategory
1-1-20231Tom1
2-2-20232Pete2
3-3-20233Steve4


TestsTable

DateCategoryEmployee
10-1-20221Tom
12-31-20221Tom
1-1-20223Tom
2-2-20232Pete
3-3-20233Steve
4-4-20235Steve
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @tomperro ,

 

Here are the steps you can follow:

 

1. Create measure.

Flag =
var _maxdate=MAXX(FILTER(ALL(TestsTable),'TestsTable'[Category]=MAX('TestsTable'[Category])),[Date])
var _eventdate=MAXX(FILTER(ALL(EventTable),'EventTable'[Category]=MAX('TestsTable'[Category])),'EventTable'[Date])
return
IF(
    _maxdate=_eventdate,1,0)

2. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_0-1698825783788.png

3. Result:

 

vyangliumsft_1-1698825783792.png

 

Best Regards,

Liu Yang

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

Hi  @tomperro ,

 

Here are the steps you can follow:

 

1. Create measure.

Flag =
var _maxdate=MAXX(FILTER(ALL(TestsTable),'TestsTable'[Category]=MAX('TestsTable'[Category])),[Date])
var _eventdate=MAXX(FILTER(ALL(EventTable),'EventTable'[Category]=MAX('TestsTable'[Category])),'EventTable'[Date])
return
IF(
    _maxdate=_eventdate,1,0)

2. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_0-1698825783788.png

3. Result:

 

vyangliumsft_1-1698825783792.png

 

Best Regards,

Liu Yang

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

lbendlin
Super User
Super User

Disconnect the tables and use TREATAS to project the filter from one table to the other.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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