Forum Discussion
preolsen
3 years agoRegular Visitor
Slicer isn't filtering data properly (with sample)
Hi! I have been working on this tiny issue all day, and cannot solve it. In the following sample dataset, there is 1 employees who submitted 2 messages from 2 different departments in the compa...
Léopold
3 years agoRegular Visitor
It does filter correctly but in your mesure you are not filtering the fact_messages based on the date, you are filtering the messages based on the relationships employee_id.
You probably want to add a filter on the date_created column of the fact_messages:
MessageCount =
VAR SelectedUnitName = SELECTEDVALUE(dim_org[unit_name])
RETURN
CALCULATE(
COUNTROWS(fact_messages),
FILTER(
dim_employees,
dim_employees[start_date] <= MAX(dim_date[Date])
&& dim_employees[end_date] >= MIN(dim_date[Date])
),
FILTER(
dim_org,
dim_org[unit_name] = SelectedUnitName
),
FILTER(
fact_messages,
fact_messages[date_created] <= SELECTEDVALUE(dim_employees[end_date])
&& fact_messages[date_created] >= SELECTEDVALUE(dim_employees[start_date])
),
)Not sure if I have that syntax correct in the filter I have added but I think you get the idea ?