Forum Discussion
How to represent a step-by-step process with rank or index
- 2 years ago
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ldK9DoMgEAfwV7kwuwj2AdqlU5PuxkHLaUwIJKfU+PYlQhuxVuvAx/Dj8ucgz9kNy84SwsPUNSJUWOqOJSx1g1D6GVJWJDm7UqvlEvII8gmepYSGjNWyg95A3aoeyQkRWTHZi2kVDKUHWQSyCdyNJQ/APN0UCjtzcqNSFsMSUn4VnBN+sKTYvvic+rQb7WwIUb/XEHarU7Hf72zsxbE4//R6RKXM8NnsXIGvnODrL7RkP37GkrnMxQs=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Step Names" = _t, #"Step Order" = Int64.Type, Groups = _t, #"ROBOT NAME" = _t]), #"Added Custom" = Table.AddColumn(Source, "Group Status", (k)=> let lm=List.Min(Table.SelectRows(Source, each [Groups]=k[Groups])[Step Order]) in Table.SelectRows(Source, each [Groups]=k[Groups] and [Step Order]=lm)[Step Names]{0},type text) in #"Added Custom"How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done". Once you examined the code, replace the Source step with your own source.
Read about TOPN or INDEX - that can give you the first row for each group, and then you can grab the step name for that row.
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information or anything not related to the issue or question.
If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
Please show the expected outcome based on the sample data you provided.
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523
- Rosalind902 years agoFrequent Visitor
Thank you for letting me know, I've updated my post with a link, and hopefully clarified some things. TopN has gotten me closer to solving this, but doesn't seem quite specific enough.
- lbendlin2 years ago
Super User
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ldK9DoMgEAfwV7kwuwj2AdqlU5PuxkHLaUwIJKfU+PYlQhuxVuvAx/Dj8ucgz9kNy84SwsPUNSJUWOqOJSx1g1D6GVJWJDm7UqvlEvII8gmepYSGjNWyg95A3aoeyQkRWTHZi2kVDKUHWQSyCdyNJQ/APN0UCjtzcqNSFsMSUn4VnBN+sKTYvvic+rQb7WwIUb/XEHarU7Hf72zsxbE4//R6RKXM8NnsXIGvnODrL7RkP37GkrnMxQs=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Step Names" = _t, #"Step Order" = Int64.Type, Groups = _t, #"ROBOT NAME" = _t]), #"Added Custom" = Table.AddColumn(Source, "Group Status", (k)=> let lm=List.Min(Table.SelectRows(Source, each [Groups]=k[Groups])[Step Order]) in Table.SelectRows(Source, each [Groups]=k[Groups] and [Step Order]=lm)[Step Names]{0},type text) in #"Added Custom"How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done". Once you examined the code, replace the Source step with your own source.
- Rosalind902 years agoFrequent Visitor
This did the trick! Thank you!