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(
FILTER(ALLSELECTED(āDateā),
āDateā[Date] >= min(āDateā[Date]) &&
āDateā[Date] <= max(āDateā[Date])
),
āDateā[isWorkday]
)
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
Thank you
Neville