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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
AdityaPowerBI
Helper II
Helper II

Conditional formatting matrix values based on other table column values

I have a matrix of employee hours as values, dates as columns and names as rows. I need to conditional format all the days for those employee where:

1) Date is more than hired date of employee and less than released date of employee

2) Date is a weekday

3) Entered hours is less than required daily hours.

I have an employee table which has employee name, required daily hours, hire date and release date. the transactional table which has all the enter hours for employees is joined with employee table. My main issue is getting the hire date, release date and daily required hours from employee table to compare with hours present in transactional table. I tried creating a flag to use for conditional formatting:

IF([WeekDay- Weekend] = "Weekday" && [Selected Date] > MIN(Employee[Employee.dateHired])
&& [Selected Date] < MIN(Employee[Employee.dateReleased] && [hours] > [daily required hours]) ,1,0)
The problem with above dax is that instead of bringing date hired and released for each employee it is
bringing overall earliest hired date and overall earliest release date from employee table. Appreciate your help.
 
 
1 ACCEPTED SOLUTION
AdityaPowerBI
Helper II
Helper II

I got the answer. Thanks all for reading this. Here is what I did :

I created measure for selected date hired, selected date released for the employee in the context.

 

SelectedStaff = SELECTEDVALUE(table[table.employee]) to capture the staff in context
Selected Date Hired = CALCULATE(MIN(Employee[Employee.dateHired]),FILTER(Employee,Employee[Employee.displayName] = [SelectedStaff])) to capture the hired date of employee in context
Similar dax for date release. Finally created the outstanding flag with below formula:
Outstanding flag = IF([WeekDay- Weekend] = "Weekday" && [Selected Date] >= [Selected Date Hired] && [Selected Date] <= MAX(TODAY(),[Selected Date Released]) && [Available Hours new] >= [Selected Daily Hours] ,1,0)
Applied the conditional formatting through outstanding flag on the entered hours by rule. It worked

View solution in original post

3 REPLIES 3
AdityaPowerBI
Helper II
Helper II

I got the answer. Thanks all for reading this. Here is what I did :

I created measure for selected date hired, selected date released for the employee in the context.

 

SelectedStaff = SELECTEDVALUE(table[table.employee]) to capture the staff in context
Selected Date Hired = CALCULATE(MIN(Employee[Employee.dateHired]),FILTER(Employee,Employee[Employee.displayName] = [SelectedStaff])) to capture the hired date of employee in context
Similar dax for date release. Finally created the outstanding flag with below formula:
Outstanding flag = IF([WeekDay- Weekend] = "Weekday" && [Selected Date] >= [Selected Date Hired] && [Selected Date] <= MAX(TODAY(),[Selected Date Released]) && [Available Hours new] >= [Selected Daily Hours] ,1,0)
Applied the conditional formatting through outstanding flag on the entered hours by rule. It worked

AdityaPowerBI
Helper II
Helper II

@amitchandak  As I mentioned names are in rows. Names are nothing but employee names.

amitchandak
Super User
Super User

@AdityaPowerBI , in this case, employee needs to there in visual (means in context), can you share what all you plan to have in the output table.

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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