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
navafolk
Helper III
Helper III

Add sheet name to folder query

Hi pros,

I am using query excel files from Folder.

It is good that Power Query automatically adds file name column to corresponding data, something like:

NameAccAmount
file1.xlsxacc11
file1.xlsxacc22
file2.xlsxacc12

 

Similarly, I would like to add sheet name column (which I chose at Navigation step) to corresponding data too, expected:

NameSheetAccAmount
file1.xlsx

sheet1

acc11
file1.xlsxsheet1acc22
file2.xlsxsheet1acc12

Furthermore, I wish sheet name added will be dynamic to my chosen at Navigation step which will not lost reference when I select another sheet at Navigation step. Please help!

Thanks a lot.

10 REPLIES 10

Thank you, @amitchandak ,

I have tried solution in first link https://community.powerbi.com/t5/Desktop/Add-custom-column-with-sheet-name/td-p/877507

, but Added Custom step is not dynamic enough. If I change my navigation sheet, this step will lost reference.

 

And I do not want to run macro in my file following solution in second link https://community.powerbi.com/t5/Desktop/Loading-from-Excel-How-can-I-extract-the-sheet-name-of-exce...

 

Pragati11
Super User
Super User

Hi @navafolk ,

 

Can you add some detail to it please, preferably some screenshots on what your query is?

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

hi @Pragati11 ,

I have edited my initial post, hope it is clearer.

thank you.

Hi @navafolk ,

 

There are existing threads for this:

https://community.powerbi.com/t5/Desktop/Add-custom-column-with-sheet-name/td-p/877507

https://community.powerbi.com/t5/Desktop/Add-a-column-with-the-sheet-name/td-p/537333

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Thank you @Pragati11 ,

For your first link solution, unfortunately, I do not have any other column to translate to my needed sheet name.

For you second link solution, I got same problem as @amitchandak  suggestion as above.

Hi @navafolk ,

 

 Can you share the screenshot for the error please?

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

hi @Pragati11 ,

Before change navigation sheet, it worked fine:

Capture.PNG

Before change navigation sheet, it lost reference, Expression.Error:

Capture2.PNG

Hi @navafolk ,

 

In your 2nd screesnhot, replace the ADDED CUSTOM step with the same ADDED CUSTOM step in 1st screesnhot.

You are not referring to the source correctly in 2nd screesnhot. It has got a CHANGED TYPE step name which is wrong. It should be SOURCE.

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Thanks @Pragati11 ,

Sure I have to replace as same name as Navigation step. I mean is there any way to help Power Query automatically realize and replace this at name step?

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.