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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Max date form different table with filter

Hi all,

 

I'm having issues with comparing two dates in different tables. One is a table with employee info, the other one a datetable.I I'm trying to create a measure which return True when the date out of service is earlier then the max date of the selected period, so that I can filter out the people that where no longer in service in a selected period.

 

For the measure Out of Service Today the following code works fine:
Out of service Today = if(and('Employees'[Date out of Service]<>BLANK();'Employees'[Date out of Service]<TODAY());true();FALSE())

But when I try to do the same trick for al eelected period it allways return a true when Date out of Service is not blank.
Out of service in period = if(and('Employees'[Date out of Service]<>BLANK();'Employees'[Date out of Service]<MAX('Calendar'[Date]));true();FALSE())

I'm guessing this is because of the lack of relationsship between those two, but I'm having diffeculty finding how to implement a solution. A active relation doesnt provide the solution because of the blank dates and other relations in the model. And I dont get how to implement a inactive relation in a IF measure.

 

Hope someone here can help me with this problem!

 

Koen

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi,@The_Coon 

      After my research, the two formulas above is calculate column, not measure. You can use this formula to add a measure instead of the column:

new Out of service in period = if(and(CALCULATE(MAX(Employees[Date out of Service])<>BLANK()),CALCULATE(MAX(Employees[Date out of Service])<MAX('Calendar'[Date]))),TRUE(),FALSE())

Result:

7.PNG

After I changed date

8.PNG

 

Best Regards,

Lin

 

Community Support Team _ Lin
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
v-lili6-msft
Community Support
Community Support

hi,@The_Coon 

      After my research, the two formulas above is calculate column, not measure. You can use this formula to add a measure instead of the column:

new Out of service in period = if(and(CALCULATE(MAX(Employees[Date out of Service])<>BLANK()),CALCULATE(MAX(Employees[Date out of Service])<MAX('Calendar'[Date]))),TRUE(),FALSE())

Result:

7.PNG

After I changed date

8.PNG

 

Best Regards,

Lin

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Lin, you are the greatest. Worked like a charm offcourse. Thanks for helping me to start the day with a smile.

 

Koen

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!

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.

Top Solution Authors
Top Kudoed Authors