Forum Discussion
Problem with FILTER
- 5 years ago
Sorted it out;
RegionAgedTicketCount =
VAR
Region = SELECTEDVALUE(Technicians[TechRegion])
RETURN
CALCULATE(
COUNT(sndata[Call]),
Technicians[TechRegion] = Region,
FILTER(ALLEXCEPT(sndata, 'Calendar'), DATEDIFF(sndata[OpenedDate], COALESCE(sndata[ResolvedDate], TODAY()), DAY) >= 60)
)
That seems to work. I assumed CALCULATE would apply the filters sequentially but that seems to not be the case as this works even with the Technicians[TechRegion] = Region in the sequence ahead of the FILTER. Ended up being a simple solution I guess.
Attaching this to hopefully illustrate the problem. The visual has a filter applied to it limiting it to one single technician. In the first example Regional Average 1 you can see that it's able to correctly calculate the regional total. In the second example as soon as the FILTER line is added in the filter on the visual for the single technician is being re-applied and it's not calculating the correct regional average.
Sorted it out;
RegionAgedTicketCount =
VAR
Region = SELECTEDVALUE(Technicians[TechRegion])
RETURN
CALCULATE(
COUNT(sndata[Call]),
Technicians[TechRegion] = Region,
FILTER(ALLEXCEPT(sndata, 'Calendar'), DATEDIFF(sndata[OpenedDate], COALESCE(sndata[ResolvedDate], TODAY()), DAY) >= 60)
)
That seems to work. I assumed CALCULATE would apply the filters sequentially but that seems to not be the case as this works even with the Technicians[TechRegion] = Region in the sequence ahead of the FILTER. Ended up being a simple solution I guess.