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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Need to find matching names in two tables and date in one column greater than the other

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

Hi,

 

Please try to create this calculated column in 'Empolyee' table first:

Column = DATEDIFF(RELATED(Contractor[Hire Date]),Employee[Hire Date],DAY)

Then try this color measure:

Color = IF(MAX(Employee[Column])=MINX(FILTER(ALL(Employee),Employee[Column]>=0),Employee[Column]),"#FF0000")

Apply this measure to the 'Employee'[Name] field, the result shows:

15.PNG 

See my attached pbix file.

 

Best Regards,

Giotto

View solution in original post

6 REPLIES 6
v-gizhi-msft
Community Support
Community Support

Hi,

 

Please try to create this calculated column in 'Empolyee' table first:

Column = DATEDIFF(RELATED(Contractor[Hire Date]),Employee[Hire Date],DAY)

Then try this color measure:

Color = IF(MAX(Employee[Column])=MINX(FILTER(ALL(Employee),Employee[Column]>=0),Employee[Column]),"#FF0000")

Apply this measure to the 'Employee'[Name] field, the result shows:

15.PNG 

See my attached pbix file.

 

Best Regards,

Giotto

amitchandak
Super User
Super User

Create a common employee name dimension. Now take date diff from both tables and use that to do conditional formatting

refer how to take date diff

https://community.powerbi.com/t5/Community-Blog/Decoding-Direct-Query-in-Power-BI-Part-2-Date-Differ...

 

For highlight : https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
nandukrishnavs
Community Champion
Community Champion

@Anonymous 

 

Try the below-calculated column 

StatusCheck = 
var _contractHireDate=LOOKUPVALUE(ContractorTable[Hire Date],ContractorTable[Name],EmployeeTable[Name])
var _hireDate= EmployeeTable[Hire Date]
var _result= IF(ISBLANK(_contractHireDate),"Not Present in Contractor Table",IF(_hireDate>_contractHireDate,"Employee hire date is greater than contractor hire date","Employee hire date is less than contractor hire date"))
return _result

 

Capture.JPG

 



Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂

 


Regards,
Nandu Krishna

Anonymous
Not applicable

@nandukrishnavs  hi im getting a error that "A table of multiple values was supplied where a single value was expected." for this dax measure

@Anonymous  Did you create measure or calculated column?

 


Regards,
Nandu Krishna

Hi @Anonymous ,

 

Try this one:

Capture.PNG

 

Did I answer your question? Mark my post as a solution!
Ricardo



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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 Solution Authors