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
shelly_sethi
Frequent Visitor

Exporting data from website and all headers are coming as columns,I need them header

 

I have a data where in people are filling some forms on website and I am exporting that data in Power BI.

Problem is data is coming in below format.I want name,email,phone ans state as headers and their corresponding data as rows under them.Please help.

col1 col2

Name xyz

phone 374627

state eerfer

email erferf

Name wferf

phone 45454

state rferf

email erferf

Thanks

1 ACCEPTED SOLUTION

See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ddC7DoMgFIDhd2F2ELlU965NunQyDihQSUSNGGrfvieYhl4wsJB8gZ9T10ibxa2jsAplCHNWYlJinHNSwbnbvN9goSarUTfZWYzPBJPaa78jZYUZEsRJ6TS4gOzUmkHN/TSmHqWEcU4ZZ8G6VawpdVZDb4L4/8CJFgWtir3s/ehvfkQPrRbYif5o9L3VspWH+VFCPrTzRHw0t+tBOSeEVHkeBgbpXibTP5WIP/xujwgmD1cdpkfIKMw9NfZILlDevAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [col1 = _t, col2 = _t, col3 = _t]),
    #"Removed Columns" = Table.RemoveColumns(Source,{"col2"}),
    #"Added Index" = Table.AddIndexColumn(#"Removed Columns", "Index", 1, 1, Int64.Type),
    #"Divided Column" = Table.TransformColumns(#"Added Index", {{"Index", each _ / 5, type number}}),
    #"Rounded Up" = Table.TransformColumns(#"Divided Column",{{"Index", Number.RoundUp, Int64.Type}}),
    #"Pivoted Column" = Table.Pivot(#"Rounded Up", List.Distinct(#"Rounded Up"[col1]), "col1", "col3"),
    #"Removed Columns1" = Table.RemoveColumns(#"Pivoted Column",{"Index"})
in
    #"Removed Columns1"

 

View solution in original post

8 REPLIES 8
Vijay_A_Verma
Super User
Super User

See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8kvMTVXSUaqorFKK1YlWKsjIzwPxjc1NzIzMwULFJYklIKHU1KK01CKwUGpuYmYOSAgkkgYWgppTDheAmWRiCoQoBiE0oZsTCwA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [col1 = _t, col2 = _t]),
    #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
    #"Filtered Rows" = Table.SelectRows(#"Promoted Headers", each ([Name] <> "Name"))
in
    #"Filtered Rows"

 

Thanks a ton...it is working

No luck Name and its value XYZ promoted to header and col1 and col2 removed,rest all below values are same.But the second name also removed from data.

shelly_sethi_0-1658145083993.png

 

If you want to retain 2nd and onwards names, just delete the Filter step.

It is not working,please share few more ways.

Can you post the result expected for the input table given? You can make the output in Excel and post the screenshot here. 

API output

col1col2col3
firstname1658138110639cxvvxvxv
company1658138110639dfvfvv
email1658138110639sddsfdfv
mobilephone1658138110639435664565
state1658138110639Delhi
firstname1658137422492dfvdfv
company1658137422492wferfer
email1658137422492fgbfdbd
mobilephone16581374224924355656
state1658137422492UP
firstname1658136333900sdfvdvd
company1658136333900sdafvdfv
email1658136333900dsfvdv
mobilephone1658136333900546455
state1658136333900MP

 

Format I am looking for

firstnamecompanyemailmobilephonestate
cxvvxvxvdfvfvvsddsfdfv435664565Delhi
dfvdfvwferferfgbfdbd4355656UP
sdfvdvdsdafvdfvdsfvdv546455MP

 

Hope this helps now.

See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ddC7DoMgFIDhd2F2ELlU965NunQyDihQSUSNGGrfvieYhl4wsJB8gZ9T10ibxa2jsAplCHNWYlJinHNSwbnbvN9goSarUTfZWYzPBJPaa78jZYUZEsRJ6TS4gOzUmkHN/TSmHqWEcU4ZZ8G6VawpdVZDb4L4/8CJFgWtir3s/ehvfkQPrRbYif5o9L3VspWH+VFCPrTzRHw0t+tBOSeEVHkeBgbpXibTP5WIP/xujwgmD1cdpkfIKMw9NfZILlDevAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [col1 = _t, col2 = _t, col3 = _t]),
    #"Removed Columns" = Table.RemoveColumns(Source,{"col2"}),
    #"Added Index" = Table.AddIndexColumn(#"Removed Columns", "Index", 1, 1, Int64.Type),
    #"Divided Column" = Table.TransformColumns(#"Added Index", {{"Index", each _ / 5, type number}}),
    #"Rounded Up" = Table.TransformColumns(#"Divided Column",{{"Index", Number.RoundUp, Int64.Type}}),
    #"Pivoted Column" = Table.Pivot(#"Rounded Up", List.Distinct(#"Rounded Up"[col1]), "col1", "col3"),
    #"Removed Columns1" = Table.RemoveColumns(#"Pivoted Column",{"Index"})
in
    #"Removed Columns1"

 

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.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors
Top Kudoed Authors