Forum Discussion

marsclone's avatar
marsclone
Helper IV
7 years ago
Solved

Unpivoting goes wrong

Hello,

 

I have the following situation.

I have a folder, with different files. Each file contains numbers from an company. These numbers are shown in different columns per year. The first files had the years 2017 till 2013.

Everything goes fine, when i select the first two columns and select 'unpivot other columns'.

 

 CompanyP&L31-12-201731-12-201631-12-201531-12-201431-12-2013
File1ARevenue10511010510095
File2BRevenue9998979695

 

transforms in

 

CompanyP&LDateAmount
ARevenue31-12-2017105
ARevenue31-12-2016110
ARevenue31-12-2015105
ARevenue31-12-2014100
ARevenue31-12-201395
BRevenue31-12-201799
BRevenue31-12-201698
BRevenue31-12-201597
BRevenue31-12-201496
BRevenue31-12-201395

 

But the problem occurs when i add a new file to the folder, where the years are from 2018 till 2014, then it transforms from

 

 CompanyP&L31-12-201831-12-201731-12-201631-12-201531-12-2014
File3CRevenue140135130125

120

 

to 

 

CompanyP&LDateAmount
ARevenue31-12-2017105
ARevenue31-12-2016110
ARevenue31-12-2015105
ARevenue31-12-2014100
ARevenue31-12-201395
BRevenue31-12-201799
BRevenue31-12-201698
BRevenue31-12-201597
BRevenue31-12-201496
BRevenue31-12-201395
CRevenue31-12-2017140
CRevenue31-12-2016135
CRevenue31-12-2015130
CRevenue31-12-2014125
CRevenue31-12-2013120

 

The years from company C are seen as the years 2017 till 2013, where it must be 2018 till 2014!

 

Is there a solution for this, or inherently working like this?

 

I've added a testfile, thank you in advance.

Regards Marcel

 

TEST FILE

  • Hi  marsclone ,

    Since the column of the first file is set to be the standard at the time of import, the default column name is returned when the column name is inconsistent. So you need to re-import the files with inconsistent column names. Then use “Append columns” to get a collection of two tables.

     

    Best Regards,

    Eads

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • v-eachen-msft's avatar
    v-eachen-msft
    Community Support

    Hi  marsclone ,

    Since the column of the first file is set to be the standard at the time of import, the default column name is returned when the column name is inconsistent. So you need to re-import the files with inconsistent column names. Then use “Append columns” to get a collection of two tables.

     

    Best Regards,

    Eads

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • marsclone's avatar
      marsclone
      Helper IV

      Hi v-eachen-msft 

       

      With your advice, i made multiple queries and appended them.

      This works.

       

      Thank you!

       

      Regards Marcel