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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Mederic
Post Patron
Post Patron

Fill a column with identical labels

Hello everyone,
I have a column with a number of nested data that repeat every 5 values
How do I get a column with label names? (see screenshot)

Thanks in advance

Best Regards

 

Input
James
M
A213
19/05/1994
London
Maria
F
B623
28/06/1974
Paris
Anthony
M
A931
21/09/1983
Berlin

 

FillDown.jpg

 

1 ACCEPTED SOLUTION
ronrsnfld
Super User
Super User

Here's one way:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8krMTS1WitWJVvIFk45GhsZghqGlvoGpvqGlpQmY65Ofl5KfB1GYWJSZCGa5gUknMyOIFiMLfQMzoBZziJYAoDqI0Y55JRn5eZXI1lgaG0L0GOobWAL1WECMcEotyskEWhMLAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Input = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Input", type text}}),

    Labels = {"Name","Gender","ID","Birth","City"},
    #"Label Column" = List.Repeat(Labels,Table.RowCount(#"Changed Type")/5),

    #"Add Label Column" = Table.FromColumns(
        Table.ToColumns(#"Changed Type") & 
        {#"Label Column"}, Table.ColumnNames(#"Changed Type") & {"Result"}),

    #"Changed Type1" = Table.TransformColumnTypes(#"Add Label Column",{{"Result", type text}})
in
    #"Changed Type1"

ronrsnfld_0-1696110012374.png

 

 

View solution in original post

2 REPLIES 2
Mederic
Post Patron
Post Patron

Hello @ronrsnfld ,

Thank you very much, it worked perfectly as always 🙂
Have a nice day

ronrsnfld
Super User
Super User

Here's one way:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8krMTS1WitWJVvIFk45GhsZghqGlvoGpvqGlpQmY65Ofl5KfB1GYWJSZCGa5gUknMyOIFiMLfQMzoBZziJYAoDqI0Y55JRn5eZXI1lgaG0L0GOobWAL1WECMcEotyskEWhMLAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Input = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Input", type text}}),

    Labels = {"Name","Gender","ID","Birth","City"},
    #"Label Column" = List.Repeat(Labels,Table.RowCount(#"Changed Type")/5),

    #"Add Label Column" = Table.FromColumns(
        Table.ToColumns(#"Changed Type") & 
        {#"Label Column"}, Table.ColumnNames(#"Changed Type") & {"Result"}),

    #"Changed Type1" = Table.TransformColumnTypes(#"Add Label Column",{{"Result", type text}})
in
    #"Changed Type1"

ronrsnfld_0-1696110012374.png

 

 

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!

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Solution Authors
Top Kudoed Authors