Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I am having difficulty with a problem that I am trying to solve. I am trying to display the Parent and all Child records, when a value from one of the child records is selected from a filter, that is seperate from the data.
I have been able to display all child records when the selected value matches the parent record as well as the parent when a child record is selected, but I am having difficulty getting all the child records.
Here is my Data
ID | Parent ID | Type | Assigned |
1 | Type1 | PersonA | |
2 | Type1 | PersonB | |
3 | Type1 | PersonC | |
4 | 1 | Type2 | PersonB |
5 | 2 | Type2 | Person A |
6 | 3 | Type2 | PersonD |
7 | 2 | Type3 | PersonC |
8 | 1 | Type3 | PersonB |
9 | 3 | Type3 | PersonA |
Desired Result - If PersonD is selected from the Filter, then display the following
ID | Parent ID | Type | Assigned |
3 | Type1 | PersonC | |
6 | 3 | Type2 | PersonD |
9 | 3 | Type3 | PersonA |
I've tried taking the parent ID of a row and then creating a filtered table to see if the the selected Assigned value exists in that filterd table, but I can't seem to quite get the logic right. Is there a different way I should approach this. Thanks for any assistance.
Solved! Go to Solution.
So I solved my issue. and it was such an easy fix. There was a filter being applied on my data, which resulted in me not getting what I wanted. Once I added All(Table) to my filter, I got the results i was looking for. For anybody else looking for this, here is my solution.
RelatedtoAssigned =
var result = switch(max('Table'[Type]),
"Type1",if(CONTAINS( Filter(all('Table'),'Table'[ParentID]=max('Table'[Id])),'Table'[Assigned],[SelectionAssignedTo]),1,0),
"Type2",if(CONTAINS( Filter(all('Table'),'Table'[ParentID]=max('Table'[ParentID])),'Table'[Assigned],[SelectionAssignedTo]),1,0),
"Type3",if(CONTAINS( Filter(all('Table'),'Table'[ParentID]=max('Table'[ParentID])),'Table'[Assigned],[SelectionAssignedTo]),1,0))
return
result
Where [SelectionAssignedTo] is a measure that gets the value selected in the filter
So I solved my issue. and it was such an easy fix. There was a filter being applied on my data, which resulted in me not getting what I wanted. Once I added All(Table) to my filter, I got the results i was looking for. For anybody else looking for this, here is my solution.
RelatedtoAssigned =
var result = switch(max('Table'[Type]),
"Type1",if(CONTAINS( Filter(all('Table'),'Table'[ParentID]=max('Table'[Id])),'Table'[Assigned],[SelectionAssignedTo]),1,0),
"Type2",if(CONTAINS( Filter(all('Table'),'Table'[ParentID]=max('Table'[ParentID])),'Table'[Assigned],[SelectionAssignedTo]),1,0),
"Type3",if(CONTAINS( Filter(all('Table'),'Table'[ParentID]=max('Table'[ParentID])),'Table'[Assigned],[SelectionAssignedTo]),1,0))
return
result
Where [SelectionAssignedTo] is a measure that gets the value selected in the filter
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
96 | |
95 | |
83 | |
70 | |
66 |
User | Count |
---|---|
118 | |
106 | |
93 | |
79 | |
72 |