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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
T-Pan
Helper I
Helper I

Get data from folder issue.

Hello everyone, on my job i have to create a report which will be updated daily with the excels in picture below. As you will see, all columns of these excels have the same Column names except the second column. So if i want to choose to get data from folder it works perfectly for all columns except the second which only returns the values of the excel wich i use as sample. I could also upload every day the excel and append the columns with same name and merged the columns with different names into a new column, but what i am looking for is a more automated procedure through power query and not a daily manual append. Does anyone know a way to solve this?

 

3.PNG

2.PNG

1.PNG

  

 

 

 

1 ACCEPTED SOLUTION
T-Pan
Helper I
Helper I

@spinfuzer @m_dekorte , in tranform sample query, i deleted the promote to headers step and add another step of "delete the first row". So now i have column 1, column 2, etc,  as headers and in my appended query  renamed the columns as i want. I don't know if its the right way but it works.

View solution in original post

11 REPLIES 11
T-Pan
Helper I
Helper I

@spinfuzer @m_dekorte , in tranform sample query, i deleted the promote to headers step and add another step of "delete the first row". So now i have column 1, column 2, etc,  as headers and in my appended query  renamed the columns as i want. I don't know if its the right way but it works.

That sounds good.  All you need to do is make sure you have the same column names one way or another.

m_dekorte
Super User
Super User

Alternatively you can transform column names, that will look something like this:

Table.TransformColumnNames( PrevStepName, each if Text.Contains(_, ".") then Text.AfterDelimiter(_, " ") else _)

 

And if as you say it is always the second column, you can easily extract that date and add its value to a new column in the table. That will look something like this.

Table.AddColumn( PrevStepName, "Date", each Text.BeforeDelimiter( Table.ColumnNames(PrevStepName){1}, " ")) 

I do this after i have combined the excels in power query?(get data from folder / combine and tranform) 

No, you would add that to the Transform Sample Query. If you share the code that's in that Transform Sample Query, we can help incorporate that rename step and optionally the add column step as well if desired.

Tomorrow morning will ne the first thing that i will do when i arrived to the office, be sure about that. 😛

spinfuzer
Super User
Super User

Edit the Sample File.

Demote Headers

Extract Text After Delimiter Space on the second column

Promote Headers.  The column name is now just "Missing".

But again its different Column name from the other Excels as you can see from images.  Will ot work?

You need to edit the Transform Sample Query and edit the Main Query because the Main Query might be broken because the column name(s) are different.   You can probably just delete the steps with errors.

spinfuzer_2-1704314284482.png

 

 
 

 

 

 

 

Is Column2 always "Date Missing"?  Date followed by a space then Missing?  If so, yes, it will work.

 

Yes the format o column 2 name is always the same. I've asked the it department to named it "missing" and create another column with "Date". But demands to IT Department always take a lot of time to be made.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors