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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.