Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
I am trying to do the reverse of what many others seem to be trying to do. I have an output of a list of parts that uses spaces to indicate what level they are at under the parent assembly above. I want to add a column that shows this relationship numerically, like I have in the example below.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wck4sUtJRMlSK1YlWUnDNS8/MSwXx9aAiCgGZxSX5eRAhuCBQFC6kZwQTDMrMS4eLGkNE3VMTi5LyK8DCMIUe+aXFMKVGcDNBKqFCQIWxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Part Name" = _t, Output = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Part Name", type text}, {"Output", type text}})
in
#"Changed Type"
hii @justlogmein ,
Can you please provide input in text format and output also so that I can understand the question?
All of the info is already there. The input is an indented list, so there are are a number of spaces until the words, which designate the level. The part's parent part is the one on the previous indentation directly above it. The output column I have included in the M code already above. It is a numbered list which outlines which parents it has come from.
You can see below that the Ring and Pin are under the Piston assembly, which are under the Engine assembly, which are under the Car assembly. And the Housing and Gear are under the Gearbox assembly, which is under the Car assembly.
Input:
Part Name
Car |
Engine |
Piston |
Pin |
Ring |
Gearbox |
Housing |
Gear |
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
24 | |
12 | |
11 | |
11 | |
8 |
User | Count |
---|---|
42 | |
25 | |
14 | |
14 | |
12 |