Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Stephan_FL
New Member

Expanding List field to add rows but include the original row number (Tricky one here)

Ok I have a API Json data that includes a status fields that is a list of status for each day of the month from 1 to 30 (or 31) depending on the month I extract. What I need is to expand this list to include the status but also the original position/row number so I can match the status to the day of the month any thoughts:

 

Data in the List FieldData in the List FieldDaily AV List (Original)Daily AV List (Original)If I just did a Expand to new rowsIf I just did a Expand to new rows

1 ACCEPTED SOLUTION
JoeBarry
Solution Sage
Solution Sage

Hi @Stephan_FL 

 

Maybe try indexing.

 

I think this video will be able to help create a numbered index for each day. Group by the Machine ID 

 

https://www.youtube.com/watch?v=_PBX3RPXxHw

 

Hope this helps

Joe

If this post helps, then please Accept it as the solution

 

 

 

 

 

 

 

View solution in original post

3 REPLIES 3
Stephan_FL
New Member

Thank you @JoeBarry that was just the direction I needed

v-xinruzhu-msft
Community Support
Community Support

Hi @Stephan_FL 

You can put the following code to advanced editor

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlTSUTIE4uJKpVgdMrmZeWBuEpBphJCFcQnLxgIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", Int64.Type}, {"Column3", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Column1", "Column2"}, {{"Count", each _, type table [Column1=nullable text, Column2=nullable number, Column3=nullable text]}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.AddIndexColumn([Count],"Index",1,1)),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Count"}),
    #"Expanded Custom" = Table.ExpandTableColumn(#"Removed Columns", "Custom", {"Column3", "Index"}, {"Column3", "Index"}),
    #"Filtered Rows" = Table.SelectRows(#"Expanded Custom", each ([Index] = 1))
in
    #"Filtered Rows"

Output

vxinruzhumsft_0-1696212932886.png

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

JoeBarry
Solution Sage
Solution Sage

Hi @Stephan_FL 

 

Maybe try indexing.

 

I think this video will be able to help create a numbered index for each day. Group by the Machine ID 

 

https://www.youtube.com/watch?v=_PBX3RPXxHw

 

Hope this helps

Joe

If this post helps, then please Accept it as the solution

 

 

 

 

 

 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.