Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Unpivot data source for multiple files before stacking all data files into one.

Hi,   Im using Listed Columns to get data without specifying column names and numbers. My data comes every week by new excel files respectively and the thing is sometimes column names or numbers o...
  • MFelix's avatar
    MFelix
    1 year ago

    Hi Anonymous ,

     

    I understand the request you have however I believe I'm not being very clear on how Power Query can solve the problem.

     

    When you get data from a file you first must open that file and then make the several steps you need to make the changes, this means that you need to open each file and proceed to the pivot of the tables and then unpivot based on all the names you will get.

     

    This can be achieve automating the process of accessing each file using a custom function that will allow you to return the data inside each file in the format you refer:

    Week Category Value
    1 ColumnA 00
    1 ColumnB 00
    1 ColumnC  
      (skipped) 00
    5 ColumnC 00
    5 ColumnZ 00
    5 ColumnD 00

     

    After this you can continue with additional steps.

     

    The custom function may allow you to do a more simpler or complex treatment of the data based on if you want have many steps replicated or just some simple changes and then the complex ones to be applied to the full set of files after the first interaction.

     

    If you allow me the question once again what is the type of file you are dealing with belive it's not reference on your initial post and I can send you an example of what I mean.