Forum Discussion

lmperplies's avatar
lmperplies
Regular Visitor
3 years ago
Solved

How can I pull data based on a predecessor?

I have a table where the key is the Activity ID. This Activity ID is used to identity predecessors for a specific Activity ID.   For example Activity ID Predecessors C B which is same Acti...
  • v-yanjiang-msft's avatar
    3 years ago

    Hi lmperplies ,

    According to your description, I create a sample.

    Activity table:

    Predecessors table:

    The two tables are related with Activity ID column.

    Here's my solution, create three measures.

    StartDate =
    MAXX (
        FILTER (
            ALL ( 'Activity' ),
            'Activity'[Activity ID] = MAX ( 'Predecessors'[Predecessors] )
        ),
        'Activity'[Start Date]
    )
    
    FinishDate =
    MAXX (
        FILTER (
            ALL ( 'Activity' ),
            'Activity'[Activity ID] = MAX ( 'Predecessors'[Predecessors] )
        ),
        'Activity'[Finish Date]
    )
    
    ActivityStatus =
    MAXX (
        FILTER (
            ALL ( 'Activity' ),
            'Activity'[Activity ID] = MAX ( 'Predecessors'[Predecessors] )
        ),
        'Activity'[Activity Status]
    )
    

    Then put Activity ID column from Activity table into a slicer, put Activity ID and Predecessors columns from Predecessors table and the three measures into a visual, get the correct result.

    I attach my sample below for your reference.

     

    Best Regards,
    Community Support Team _ kalyj

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.