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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

Check out the August 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.