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

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
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.

Top Solution Authors