Forum Discussion
Call Agent switching Teams
- 1 year ago
You can create a measure to use as a filter on the slicer visible.
The basic pattern is something like
Agent is visible = VAR MinDate = MIN ( 'Date'[Date] ) VAR MaxDate = MAX ( 'Date'[Date] ) VAR AgentStartDate = SELECTEDVALUE ( 'Agent'[Start date] ) VAR AgentEndDate = SELECTEDVALUE ( 'Agent'[End Date] ) VAR Result = IF ( AgentStartDate <= MinDate && ( AgentEndDate >= MaxDate || ISBLANK ( AgentEndDate ) ), 1, 0 ) RETURN ResultYou may want to tweak the logic a bit to handle cases where someone leaves part way through the year. As it is they would still be included, but you might want to exclude them.
Add the measure to the slicer as a filter, set to only show when the value is 1.
- 1 year ago
You could create another calculation item like
Agent is visible calculation item = VAR MinDate = MIN ( 'Date'[Date] ) VAR MaxDate = MAX ( 'Date'[Date] ) VAR AgentStartDate = SELECTEDVALUE ( 'Agent'[Start date] ) VAR AgentEndDate = SELECTEDVALUE ( 'Agent'[End Date] ) VAR Result = IF ( AgentStartDate <= MinDate && ( AgentEndDate >= MaxDate || ISBLANK ( AgentEndDate ) ), SELECTEDMEASURE () ) RETURN Resultand use that as a page level filter
Hi,
Thanks for the solution johnt75 and DataNinja777 offered, and i want to offer some more infotmation for user to refer to.
hello Alice83 , you can refer to the following solution.
Sample data
And there is a calendar table, and there is a 1:n relationship between the tables(calendar:date->table:start date)
Creaet a measure
MEASURE =
VAR _count =
CALCULATE (
COUNTROWS ( 'Table' ),
OR (
'Table'[Start date] < MAX ( 'Calendar'[Date] )
&& 'Table'[End date] > MIN ( 'Calendar'[Date] ),
ISBLANK ( 'Table'[End date] )
),
CROSSFILTER ( 'Calendar'[Date], 'Table'[Start date], NONE )
)
RETURN
_count
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.