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.
I'm attempting to calculate the number of work days per row for each candidateID
Right now I'm getting per row the total number for work days and number of workable hours. So instead of what I'm seeing below.
I'd rather see it more like this
Currently how I'm getting an aggregate of the number of workable days and workable hours is through this code shown below.
How would I narrow it down so it's showing month by month?
Forecast Workable Days =
VAR _MonthStart = DATE(YEAR(TODAY()), MONTH(TODAY()),1)
VAR _MonthEnd = EOMONTH ( _MonthStart , 12 )
VAR _dateBegin = [dateBegin]
VAR _dateEnd = [dateEnd]
VAR _StartDate = IF ( _dateBegin >= _MonthStart , _dateBegin , _MonthStart )
VAR _EndDate = IF ( _dateEnd <= _MonthEnd , _dateEnd , _MonthEnd )
VAR _NumberWorkDays = CALCULATE( COUNTROWS('Date'), DATESBETWEEN('Date'[Date], _StartDate, _EndDate), 'Date'[Weekday] = TRUE || 'Date'[Public Holidays] <> 0)
RETURN
IF ( ISBLANK (_NumberWorkDays), 0, _NumberWorkDays)
Solved! Go to Solution.
Hi @LyonsBI_BRL ,
I created a sample pbix file(see attachment) for you, please check whether that is what you want. You can create a calculated column as below to get the working days per month:
Forecast Workable Days =
VAR _startdate =
DATE ( YEAR ( 'Date'[Date] ), MONTH ( 'Date'[Date] ), 1 )
VAR _enddate =
EOMONTH ( _startdate, 0 )
RETURN
IF (
'Date'[Date] >= _startdate
&& 'Date'[Date] <= _enddate
&& WEEKDAY ( 'Date'[Date], 2 ) <= 5
&& 'Date'[Public Holidays] = 0,
1,
0
)
If the above one is not your expected result, please provide some sample data(exclude sensitive data) and your expected result with more details(calculation logic, special examples and visual settings etc.). Thank you.
Best Regards
Hi @LyonsBI_BRL ,
I created a sample pbix file(see attachment) for you, please check whether that is what you want. You can create a calculated column as below to get the working days per month:
Forecast Workable Days =
VAR _startdate =
DATE ( YEAR ( 'Date'[Date] ), MONTH ( 'Date'[Date] ), 1 )
VAR _enddate =
EOMONTH ( _startdate, 0 )
RETURN
IF (
'Date'[Date] >= _startdate
&& 'Date'[Date] <= _enddate
&& WEEKDAY ( 'Date'[Date], 2 ) <= 5
&& 'Date'[Public Holidays] = 0,
1,
0
)
If the above one is not your expected result, please provide some sample data(exclude sensitive data) and your expected result with more details(calculation logic, special examples and visual settings etc.). Thank you.
Best Regards
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
96 | |
78 | |
68 | |
55 |
User | Count |
---|---|
145 | |
105 | |
104 | |
90 | |
63 |