I have a measure to calculate the current working days, based on the current context, and this works fine as its pretty straight forward. The issues comes when I want to calculate the working days using the SAMEPERIODLASTYEAR Function, which is not giving the correct values.
As you can see from the table below, the Measure for “Working Days Same Period LY” is not give the correct value. The number of “1’s” is actual 50, but the total value is given 65.
Working Days = sum(‘Date’[isWorkday])
Working Days Same Period LY = CALCULATE([Working Days], SAMEPERIODLASTYEAR(Date’[Date]))
I’ve tried a number of different combinations, and whilst the current context working days is already calculated correctly, the SAMEPERIODLASTYEARS is not given the correct value. The value should be 50, but its giving 65.
isWorkday is a Calculated Column
isWorkday = if(‘Date’[WeekdayNum]<=4,1,0)
I’ve also tried CountRows, and this also gives the wrong result, and many other DAX Functions
Working Days = CALCULATE(COUNTROWS(‘Date’), FILTER(ALLSELECTED(‘Date’), ‘Date’[WeekdayWeekend]=“Weekday”))
Working Days = Sumx(
‘Date’[Date] >= min(‘Date’[Date]) &&
‘Date’[Date] <= max(‘Date’[Date])
I’m clearly missing something, and is most probably staring be straight in the face, but after wasting 3 hours of my life on this, I just cannot see it, as all the above combination of Working Days gives the same result for Working Days Same Period LY