Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
13 | |
8 | |
8 | |
7 |
User | Count |
---|---|
17 | |
13 | |
7 | |
6 | |
6 |