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! Request now

Reply
Anonymous
Not applicable

Compare daily actual values against targets that are defined based on the day of the week

Hello Power BI gurus,

 

Looking for help in achieving the following. Thank you akready for the support.

1. I have list of employees who post Hours on daily basis. 

2. The maximum total hours per day are based on the day of the week for ex: monday to friday are 8 hr, and sat-sun 0 hr. I am creating a separate mapping table to store this value.

3. I want to compare the actual hours Vs the max hours.

 

The final DAX measures I am looking for is:

Count of number of days per month per person when Actual Hours > Max Hours

Count of number of days per month per person when Actual Hours < Max Hours

 

Also, if possible can I do conditional formatting based on these criteria?

 

Given data

DateWeekdayPersonActual Hours
Monday, June 1, 2020MondayP18
Tuesday, June 2, 2020TuesdayP19
Wednesday, June 3, 2020WednesdayP18
Thursday, June 4, 2020ThursdayP18
Friday, June 5, 2020FridayP17
Saturday, June 6, 2020SaturdayP10
Sunday, June 7, 2020SundayP10
Monday, June 8, 2020MondayP16
Tuesday, June 9, 2020TuesdayP18
Wednesday, June 10, 2020WednesdayP18

 

Comparison table

WeekdayMax Hours
Monday8
Tuesday8
Wednesday8
Thursday8
Friday7
Saturday0
Sunday0
1 ACCEPTED SOLUTION
AllisonKennedy
Super User
Super User

Use your DimDate table to filter by month, and try

MEASURE= COUNTROWS(FILTER(GivenData, GivenData[ActualHours]>RELATED(CompTable[MaxHours])))

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

1 REPLY 1
AllisonKennedy
Super User
Super User

Use your DimDate table to filter by month, and try

MEASURE= COUNTROWS(FILTER(GivenData, GivenData[ActualHours]>RELATED(CompTable[MaxHours])))

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.