Forum Discussion
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 Activity ID as the table below |
| C | A which is same Activity ID as the table below |
What I am trying to do is have a slicer for the Activity ID, that will allow me to display the records for predecessor B and A for the user.
Here is an Example of the main table
| Activity ID | Start Date | Finish Date | Activity Status |
| C | 1/1/2020 | 1/2/2020 | Completed |
| B | 3/4/2021 | 5/6/2021 | Completed |
| A | 5/2/2029 | Not started |
Here is what I am trying to create
Slicer
| Activity ID (user enters) |
| C |
Visual like a table
| Activity ID | Precessor | Start Date | Finish Date | Activity Status |
| C | B | 3/4/2021 | 5/6/2021 | Completed |
| C | A | 5/2/2029 | Not started |
How can I do this?
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 _ kalyjIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 Replies
- MahyarTFMemorable Member
Hi,
Not sure, if it is useful for you:
Create a table just including the ActivityId :
Sheet165NewActivity = values(Sheet165[Activity ID])Then in the main table create the measure as below :ExcluseActivity =Var _SelectCnt = COUNT(Sheet165NewActivity[Activity ID])Var _SelectIn = if( max(Sheet165[Activity ID]) in ALLSELECTED(Sheet165NewActivity[Activity ID]),1,0)Return if(_SelectCnt <> 3,if( max(Sheet165[Activity ID]) in ALLSELECTED(Sheet165NewActivity[Activity ID]),1,0),0)Then develop the slicer on the new table and ActivityId column, and in the main visual put the filter ExcludeActivity is 0As you see if each activityId is selected the other is shown an if nothing is selected the all value is shown :
Appreciate you Kudos
- lmperpliesRegular Visitor
I was able to build the new table no problem. However, my data did not enter any values in the table that I used the "ExcluseActivty" measure as a filter. I am wondering if you could share with me how you set up the Sheet165 (main table) connecting Activity C to Activity B & A as predecessors.
For activity 35m4w.10, the predecessors should be 35m4w.06 and 35m4w.07, but nothing pulls.
Here is what I am returning:
- v-yanjiang-msftCommunity Support
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 _ kalyjIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- lmperpliesRegular Visitor
Thank you so much. I was able to get this work.