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.
Hi,
I have created hierarchy structure and I need to "display all the child" of parent hierarchy.
Diagram:
1
/ \
2 3
/ |\ / \
4 5 6 7 8
/\ / \
9 10 11 12
From the above diagram,
I need if I select parent "2" then it show 4,5,9,10 child below of "2"
If I select parent "3" then it should show 7,11,12 child below of "3".
If I select parent "6" then it show 9,10 child below of "6".
If I select parent "8" then it show 11,12 child below of "8".
Note: This should happen in dynamically.
Table structure:
Projectkey | ParentKey | Path | length |
1 | 1 | 1 | |
2 | 1 | 1|2 | 2 |
3 | 1 | 1|3 | 2 |
4 | 2 | 1|2|4 | 3 |
5 | 2 | 1|2|5 | 3 |
6 | 2 | 1|2|6 | 3 |
7 | 3 | 1|3|7 | 3 |
8 | 3 | 1|3|8 | 3 |
9 | 6 | 1|2|6|9 | 4 |
10 | 6 | 1|2|6|10 | 4 |
11 | 8 | 1|3|8|11 | 4 |
12 | 8 | 1|3|8|12 | 4 |
Solved! Go to Solution.
@Anonymous
In that case we can add another condition as follows
Please see attached file as well
Measure = VAR myparent = MIN ( Parents[ParentKey] ) VAR Condition1 = PATHCONTAINS ( SELECTEDVALUE ( Table1[Path] ), myparent ) VAR condition2 = SEARCH ( myparent, SELECTEDVALUE ( Table1[Path] ), 1, 0 ) < SEARCH ( SELECTEDVALUE ( Table1[Projectkey] ), SELECTEDVALUE ( Table1[Path] ), 1, 0 ) VAR Condition3 = COUNTROWS ( FILTER ( ALL ( Table1 ), SEARCH ( SELECTEDVALUE ( Table1[Projectkey] ), Table1[Path], 1, 0 ) ) ) = 1 RETURN IF ( AND ( AND ( Condition1, condition2 ), Condition3 ), 1 )
@Anonymous
Please see if this approach helps
See the file attached as well
Assuming your TableName is Table1.
First create a calculated table from modelling tab. This will be used as slicer to select parent
Parents = FILTER ( DISTINCT ( Table1[ParentKey] ), [ParentKey] <> BLANK () )
Now we can write a MEASURE to be used as a visual filter
Measure = VAR myparent = MIN ( Parents[ParentKey] ) VAR Condition1 = PATHCONTAINS ( SELECTEDVALUE ( Table1[Path] ), myparent ) VAR condition3 = SEARCH ( myparent, SELECTEDVALUE ( Table1[Path] ), 1, 0 ) < SEARCH ( SELECTEDVALUE ( Table1[Projectkey] ), SELECTEDVALUE ( Table1[Path] ), 1, 0 ) RETURN IF ( AND ( Condition1, condition3 ), 1 )
@Anonymous
Thanks for your reply, I want only child not include parents. if select parent "3" its should show only child like 7,11,12 not 8 because "8" is parent key.
@Anonymous
In that case we can add another condition as follows
Please see attached file as well
Measure = VAR myparent = MIN ( Parents[ParentKey] ) VAR Condition1 = PATHCONTAINS ( SELECTEDVALUE ( Table1[Path] ), myparent ) VAR condition2 = SEARCH ( myparent, SELECTEDVALUE ( Table1[Path] ), 1, 0 ) < SEARCH ( SELECTEDVALUE ( Table1[Projectkey] ), SELECTEDVALUE ( Table1[Path] ), 1, 0 ) VAR Condition3 = COUNTROWS ( FILTER ( ALL ( Table1 ), SEARCH ( SELECTEDVALUE ( Table1[Projectkey] ), Table1[Path], 1, 0 ) ) ) = 1 RETURN IF ( AND ( AND ( Condition1, condition2 ), Condition3 ), 1 )
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 |
---|---|
114 | |
99 | |
83 | |
70 | |
60 |
User | Count |
---|---|
150 | |
115 | |
104 | |
89 | |
65 |