Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
I have a column called QPath_Old that contains a comma seperated path for each part. I would like to sort each part in this order based on the values in the Old Process Step ID column.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("zZhBa8JAEEb/S8572WxiJkdBeyhFpFfxIMVCQCpo+v87cSMhCHY8zTsMazaCj+8xyay7XbE9XPqYmiIUb93pdLwk/bRaxrBallop5N04ruW43verca3D+++17767r0PfnX/i/LKcX6awWUetUqvSqrUWYXPuj9fw+RG1Sq1U7MMdTwB46+YpYgtAfII3Ca6IeALAMwtGJjgI1l0imjijGcRCk5u6FoknADxz1yITnATXRDwB4JkFIxOcBEcingDwzIKRCQ6C9btENHFGM4iFJpelIt8Y4oxmkopMLk/IyNOZOKOZJmRkck2GIqKJM5pBKjS53KlINHFGM3UqMrncqciHiDijmToVmVwelLAnLwUiorVctCwU+QARZzTT5ItMLktdENFaLtotteE+EU7c4SztQE1vUDv/ASKlcCgNsiGkr1hHjlQP1tFzKYT0FevIuevBOvofPgjpv0c6bIjifG4yzbLIY504D4wmsQ0Mb/8H", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [PARTID = _t, #"Old Process Step ID" = _t, QPath_Old = _t]),
ChangedType = Table.TransformColumnTypes(Source,{{"PARTID", type text}, {"QPath_Old", type text}}),
SortedRows = Table.Sort(ChangedType,{{"PARTID", Order.Ascending}}),
PartIndex = Table.AddIndexColumn(Table.Distinct(Table.SelectColumns(SortedRows,{"PARTID"})), "Index", 1, 1, Int64.Type),
MergePartIndex = Table.NestedJoin(#"SortedRows", {"PARTID"}, PartIndex, {"PARTID"}, "PartIndex", JoinKind.Inner),
ExpandPartIndex = Table.ExpandTableColumn(MergePartIndex, "PartIndex", {"Index"}, {"Part Index"})
in
ExpandPartIndex
Solved! Go to Solution.
Hi @justlogmein ,
adding a column with this formula should do the trick:
List.PositionOf(Text.Split([QPath_Old], ","), [Old Process Step ID])
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Hi @justlogmein ,
adding a column with this formula should do the trick:
List.PositionOf(Text.Split([QPath_Old], ","), [Old Process Step ID])
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries