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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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

nandukrishnavs
Super User
Super User

@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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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