Forum Discussion

Cmpunk's avatar
Cmpunk
Copper Contributor
Apr 30, 2022

Power Query Help!!!

Hello All,

 

I am working on some files which I plan to combine and transform. Since there are multiple files I am transforming the transform sample file so that it gives me desired results. Unfortunately, after I have made my changes to the transformed sample file I am getting an error and I would appreciate if anyone can help rectify it.

 

In the transform sample file- I followed the following steps:

a)Removed Column 1 and Column 2

b)Removed first 7 rows

c)Promoted Headers

d)Unpivot other columns.

 

 

 

As you see in the first image order form I am getting an error.

 

Kindly help me rectify this error.

 

I am attaching some of the sample file that I am working on for reference.

 

 

 

 

 

 

6 Replies

  • Riny_van_Eekelen's avatar
    Riny_van_Eekelen
    Platinum Contributor

    Cmpunk Used your files and replicated your steps. The combined table works just fine.

    This is the M-code I used for the transformation sample file:

    let
        Source = Excel.Workbook(Parameter1, null, true),
        COF_Sheet = Source{[Item="COF",Kind="Sheet"]}[Data],
        #"Removed Columns" = Table.RemoveColumns(COF_Sheet,{"Column1", "Column2"}),
        #"Removed Top Rows" = Table.Skip(#"Removed Columns",8),
        #"Promoted Headers" = Table.PromoteHeaders(#"Removed Top Rows", [PromoteAllScalars=true]),
        #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Promoted Headers", {"Product"}, "Attribute", "Value")
    in
        #"Unpivoted Other Columns"

     

     

    • Cmpunk's avatar
      Cmpunk
      Copper Contributor

      Riny_van_Eekelen   I am new in Power Query and don't have much knowledge about M-code. I have attached my M-code below.

       

      Thank you for your help.  But I am still getting errors.

       

      If you look at PQ Doubt 4 image I am getting an error line in the columns.

       

       

      • Riny_van_Eekelen's avatar
        Riny_van_Eekelen
        Platinum Contributor

        Cmpunk In the file I used I had to remove 8 rows att the top. And then I would remover the Change type step and do that in the "expanded" table. Didn't look at the other files if they had the same number of undesired rows at the top.

Resources