cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
chris_k
Helper I
Helper I

Repeating Un-ordered Source to Table

Hello,

 

I am trying to turn a source that repeats column headers but in a none consistent order into a table. (The mess of the list is due to the web source which I have no control over). But I am so far getting nowhere quickly. It always repeats in a consistent number of rows per ID if that helps...

 

Input Table:

 

IDNameValue
0079e79Average0.202
0079e79Score A0.846
0079e79Score B0.916
0079e79Score G0.985
0079e79Score D0.443
0079e79Score C0.738
0079e79Score E0.683
0079e79Score F0.495
0079e79Status0.476
002e377Average0.070
002e377Score A0.453
002e377Score B0.447
002e377Score G0.765
002e377Score D0.788
002e377Score C0.143
002e377Score E0.987
002e377Score F0.285
002e377Status0.236
0061dd2Status0.140
0061dd2Average0.654
0061dd2Score A0.412
0061dd2Score B0.647
0061dd2Score E0.186
0061dd2Score F0.633
0061dd2Score D0.774
0061dd2Score C0.928
0061dd2Score G0.985

 

Output Table:

 

IDAverageScore AScore BScore GScore CScore DScore EScore FStatus
0079e790.2020.8460.9160.9850.7380.4430.6830.4950.476
002e3770.0700.4530.4470.7650.1430.7880.9870.2850.236
0061dd20.6540.4120.6470.7740.1860.6330.9280.1400.985

 

Thank you for any help,

1 ACCEPTED SOLUTION
dilumd
Solution Supplier
Solution Supplier

Hi,

You can do this with Pivot option in query editor in power BI,

 

BI Hellp.JPG

 

Code,

let
    Source = Excel.Workbook(File.Contents("C:\Users\Dilumd\OneDrive - Help Sheet.xlsx"), null, true),
    Sheet1_Sheet = Source{[Item="Sheet1",Kind="Sheet"]}[Data],
    #"Promoted Headers" = Table.PromoteHeaders(Sheet1_Sheet, [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"ID", type text}, {"Name", type text}, {"Value", type number}}),
    #"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[Name]), "Name", "Value")
in
    #"Pivoted Column"

View solution in original post

2 REPLIES 2
dilumd
Solution Supplier
Solution Supplier

Hi,

You can do this with Pivot option in query editor in power BI,

 

BI Hellp.JPG

 

Code,

let
    Source = Excel.Workbook(File.Contents("C:\Users\Dilumd\OneDrive - Help Sheet.xlsx"), null, true),
    Sheet1_Sheet = Source{[Item="Sheet1",Kind="Sheet"]}[Data],
    #"Promoted Headers" = Table.PromoteHeaders(Sheet1_Sheet, [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"ID", type text}, {"Name", type text}, {"Value", type number}}),
    #"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[Name]), "Name", "Value")
in
    #"Pivoted Column"

Thank you very much. I had no idea it was that easy!

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors