tableau-apilevel-of-detail

Handling repeated records in Tableau fixed calculation


I am trying to write a fixed calculation in tableau to get the minimum start date of employee when there is a change in Subteam. Attached a screenshot to give you an idea of what I am trying to do. It has my current result and expected result as well. Any help would be appreciated.

Thank youTableau Data


Solution

  • Starting with this sample input (I added a second employee):

    Date        Emp ID  Team
    29/02/2020  1234    AI
    31/03/2020  1234    AI
    30/04/2020  1234    ML
    31/05/2020  1234    AI
    30/06/2020  1234    AI
    01/01/2020  567     AI
    01/04/2020  567     ML
    01/07/2020  567     AI
    01/08/2020  567     AI
    

    You can approach the problem using "previous" records, using LookUp function, based on EmpId and Team:

    LOOKUP(MAX(str([Emp ID])+[Team]),-1)
    

    Now you need to filter just rows where this conditions is true:

    min(STR([Emp ID])+[Team]) != ifnull([LookUp],'XXX')
    

    The output could look like the following: enter image description here