Forum Discussion

Alice83's avatar
Alice83
Frequent Visitor
1 year ago
Solved

Call Agent switching Teams

Hello everyone   I am measuring different call data from two teams, 1st and 2nd level. I have Agents that changed teams and I need to show the respective data.   Agent A was in Team 1st until end...
  • johnt75's avatar
    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
        Result
    

    You 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.

     

  • johnt75's avatar
    johnt75
    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
        Result
    

    and use that as a page level filter