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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Anonymous
Not applicable

Adding the query name to a new column

Hello All,

I have a small question. As mentioned in the picture Iam looking for a solution where I can generate a new column in power query with the own query name in it. For example if my query name is ABCDE having a data of multiple columns and multiple rowa then I should have a new column that should be having the query name which is ABCDE  for each and every row. This should be reflected for each and every query in Power Query Editor. Can anyone please help me to find a formula for this one?

ParsiNitin_0-1653483555224.png

Note: Every query is not related to each other. Each and every query is independent.

2 REPLIES 2
Anonymous
Not applicable

Hi @rohit_singh 

I can't go forward from this step

Filter the name column using the name of the query and click on "Table" to expand the query. You will now see a reference to a specific row in the prevous step, which points to the query name.

That you have mentioned. I cant see any reference row.

rohit_singh
Solution Sage
Solution Sage

Hi @Anonymous ,

You can try using the "#sections" function in Power Query.

In Power Query, Go to "New Source" --> Blank Query. Then type in "= #sections"

 

rohit_singh_0-1653487317229.png

 

Click on "Record". This will show you a list of all queries in your file. Convert this to a table

 

rohit_singh_3-1653487549881.png


Filter the name column using the name of the query and click on "Table" to expand the query. You will now see a reference to a specific row in the prevous step, which points to the query name.

rohit_singh_5-1653487766472.png


We will use this reference now to create a new column. Click on 'Add Column' and type in the specific row that we obtained previously.

rohit_singh_6-1653487929233.png

 

This will create a new column with each row having a record datatype.

rohit_singh_7-1653488002647.png

 

Expand the column and select the "Name" field

rohit_singh_8-1653488043755.png

This gives us the query name in each row

rohit_singh_11-1653488125595.png

 

 

Kind regards,

Rohit


Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 🙂





 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Solution Authors
Top Kudoed Authors