Forum Discussion
Productivity Tracking in DAX
- Anonymous4 years ago
Hi Joseph_Hchaime ,
I created a sample pbix file(see attachment) for you, please check whether that is what you want.You can create the measures as below to get it:
Untracked Hours Per Day = VAR _whours = SUM ( 'activities'[Hours Worked] ) RETURN IF ( ISBLANK ( _whours ), BLANK (), 8 - _whours )Untracked Hours Per Week = VAR _selweek = SELECTEDVALUE ( 'Date'[Week] ) VAR _whours = CALCULATE ( SUM ( 'activities'[Hours Worked] ), FILTER ( 'activities', WEEKNUM ( 'activities'[Date] ) = _selweek ) ) RETURN IF ( ISBLANK ( _whours ), BLANK (), 40 - _whours )Untracked Hours Per Month = VAR _selmonth = SELECTEDVALUE ( 'Date'[Month] ) VAR _workingdays = CALCULATE ( COUNT ( 'Date'[Date] ), FILTER ( 'Date', 'Date'[Month] = _selmonth && 'Date'[Isworkingday] = 1 ) ) VAR _whours = CALCULATE ( SUM ( 'activities'[Hours Worked] ), FILTER ( 'activities', MONTH ( 'activities'[Date] ) = _selmonth ) ) RETURN IF ( ISBLANK ( _whours ), BLANK (), _workingdays * 8 - _whours )Untracked Hours Per Year = VAR _selyear = SELECTEDVALUE ( 'Date'[Year] ) VAR _workingdays = CALCULATE ( COUNT ( 'Date'[Date] ), FILTER ( 'Date', 'Date'[Year] = _selyear && 'Date'[Isworkingday] = 1 ) ) VAR _whours = CALCULATE ( SUM ( 'activities'[Hours Worked] ), FILTER ( 'activities', YEAR ( 'activities'[Date] ) = _selyear ) ) RETURN IF ( ISBLANK ( _whours ), BLANK (), _workingdays * 8 - _whours )If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
Can you please share some sample data and also what you want to get as a result.
Thanks
Hari
- Joseph_Hchaime4 years ago
Helper III
Date Employee Hours Worked Untracked Hours Per Day Monday, January 3, 2022 John Doe 7 1 Max Hours Per Week (5x8) 40 Tuesday, January 4, 2022 John Doe 8 0 Hours Worked 26 Wednesday, January 5, 2022 John Doe 2 6 Untracked Hours Per Week 14 Thursday, January 6, 2022 John Doe 5 3 Untracked Hours Per Month? (8*5*# weekdays) ?? Friday, January 7, 2022 John Doe 4 4 - sturlaws4 years ago
Resident Rockstar
Hi, Joseph_Hchaime,
based on your description I have created a sample dataset and report.I think it covers the specification you have given:
The IsWorkday-column in the calendar-table only considers Saturday and Sunday
Cheers,
Sturla
If this post helps, then please consider Accepting it as the solution. Kudos are nice too.