Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi gurus,
I have following devops odata script:
Can you explain your data a bit more @suojis ?
I don't understand row 3. Why is there a relatinship between 1 and 4?
Also, if you provide additional data, please use the table option so there aren't a few hundred spaces and char(160) to get rid of. There is more about sharing data to the forum at the links below.
How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingWorkItemId | TargetWorkItemId | LinkTypeName |
1 | 2 | Child |
1 | 3 | Child |
2 | 4 | Child |
3 | 1 | Related |
WorkItemId | TargetWorkID | LinkTypeName | Level |
1 | 2 | Child | 1 |
1 | 3 | Child | 1 |
1 | 4 | Child | 2 |
2 | 4 | Child | 1 |
3 | 1 | Related | 1 |
3 | 2 | Child | 2 |
3 | 4 | Child | 3 |
Hi @suojis,
I write two custom functions to analytics raw table records and extract the corresponding records, you can try it if helps. (notice: these formulas still required additional processing to check relationship levels and replace node fields values)
Recursive functions:
let
FindDenpency=(source as table, current as number, target as number, optional output as table)=>
let
search=
if output <> null
then Table.SelectRows(source, each [LinkTypeName]="Child" and [TargetWorkItemId]=current)
else Table.SelectRows(source, each [LinkTypeName]="Child" and [WorkItemId]=current and [TargetWorkItemId]=target),
merged=
if output <> null
then Table.Combine({search,output})
else search,
result =
if Table.RowCount(search) > 0
then FindDenpency(source, search{0}[WorkItemId], search{0}[TargetWorkItemId], merged)
else merged
in
result
in
FindDenpency
let
FindReference=(source as table, target as number, optional item as list, optional output as table)=>
let
search =
if item <> null
then Table.SelectRows(source, each [LinkTypeName]="Child" and List.Contains(item, [WorkItemId]))
else Table.SelectRows(source,each [LinkTypeName]="Child" and [WorkItemId] = target),
merged=
if output <> null
then Table.Combine({search,output})
else search,
result =
if Table.RowCount(search) >0
then FindReference(source,target, search[TargetWorkItemId],merged)
else merged
in
result
in
FindReference
Test table:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTICYueMzJwUpVgdiIgxighI3gRFBCQPUheUmpNYkgoUiwUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [WorkItemId = _t, TargetWorkItemId = _t, LinkTypeName = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"WorkItemId", Int64.Type}, {"TargetWorkItemId", Int64.Type}, {"LinkTypeName", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Relationship", each
if [LinkTypeName]="Child"
then FindDenpency(#"Changed Type",[WorkItemId],[TargetWorkItemId])
else FindReference(#"Changed Type",[TargetWorkItemId]))
in
#"Added Custom"
Regards,
Xiaoxin Sheng
Hi @suojis - if someone else jumps in that is great. I am slammed and I need to take a step back and look at this, so I haven't abandoned it, but this is not a quick fix that I can see yet. I will look at more earnestly tonight or tomorrow when I am past my deadline today with work. 👍
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingUser | Count |
---|---|
103 | |
88 | |
78 | |
71 | |
69 |
User | Count |
---|---|
113 | |
99 | |
97 | |
72 | |
68 |