cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Super User III
Super User III

Re: Retain file name column when using Folder as a data source - Power Query M

Hi @sljean17,

please post sample data of:

1) The source (step "Changed Type") and

2) Your desired result

Thanks.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Anonymous
Not applicable

Re: Retain file name column when using Folder as a data source - Power Query M

Hey Imke! 

 

Thanks for all the support. 

I have a slighly different problem and since I'm new to M I don't know how to proceed. 

 

In my case, I need to keep the creation date of the document, as I may benefit from it for some calculations.

How can I transform the creation date into a new column in Power Querry?

 

Thanks

Super User III
Super User III

Re: Retain file name column when using Folder as a data source - Power Query M

The column should be/stay there, if you don't use Combine Binaries but use the method I've described and add a column to retrieve the data from the "Content"-column.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

RachelEKatz95 Helper I
Helper I

Re: Retain file name column when using Folder as a data source - Power Query M

Hi @ImkeF,

 

I am doing something a little bit different and was wondering if you could help guide me in my use case. I have a SharePoint folder where different CSVs will be uploaded with different headers. Each csv will have at least one of the common merge headers, so there will always be "Key1", "Key2", or "Key3" as one of the headers - the rest might have extra data. I am trying to modify my power query to handle these cases, so that if the file only has "Key2" - just that column will be read in and the rest ignored. Or if it just has "Key1" and "Key2" - those will be read and the rest ignored.. etc

 

I created a sample file with 3 columns for the 3 keys for my default file, but I need help modifying my query because right now the new files just read the first 3 columns of data and doesn't search for "Key2" in the data. Any help on this use case?

 

Thanks in advance for the help!

Super User III
Super User III

Re: Retain file name column when using Folder as a data source - Power Query M

You have to select the 3 columns in your function before you expand. Therefore you have to modify the Table.SelectColumns-command to cater for missing columns:

 

Table.SelectColumns(AppendToSource,{"Key1", "Key2", "Key3"}, MissingField.Ignore)

That way, any of the 3 key-columns will be selected and no error will be thrown if one or more of them are missing.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Helpful resources

Announcements
‘Better Together’ T-Shirt Contest – Winner Announced!

‘Better Together’ T-Shirt Contest – Winner Announced!

And the winner is...

Announcing the New Spanish Forum

Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

Attending MBAS? Claim your badge

Attending MBAS? Claim your badge

Whether you’re streaming the digital event live, or watching on-demand, claim your attendee badge to sport on your profile.

April 2020 Community Highlights

April 2020 Community Highlights

Info on our Super Users, MBAS content and badges, and updates to our support articles. - Read the full Community Highlights.

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

Top Solution Authors
Top Kudoed Authors