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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
UsePowerBI
Post Prodigy
Post Prodigy

Is it possible to populate a column with the name of another table?

Hello

 

If I load a table from an excel file to PowerBI, can I create a new column in the table and populate it with values that equal to the name of the loaded table?

 

In other words, can I use the name of a table as a variable or value to put in fields?

 

Thanks!

6 REPLIES 6
v-alq-msft
Community Support
Community Support

Hi, @UsePowerBI 

 

If you take the answer of someone, please mark it as the solution to help the other members who have same problems find it more quickly. If not, let me know and I'll try to help you further. Thanks.

 

Best Regards

Allan

v-alq-msft
Community Support
Community Support

Hi, @UsePowerBI 

 

Based on your description, you may click 'Edit Query', go to Query Editor, create a new blank query.

 

If you use Excel connector, you may input the following codes in the 'Advanced Editor'.

b1.png

 

Then you need to input the Filename to get the result.

b2.png

 

If you use folder connector, you may input the following codes in 'Advanced Editor'.

b3.png

 

Here is the result.

b4.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

camargos88
Community Champion
Community Champion

Hi @UsePowerBI ,

 

If you are using Power Query you can go to to 2nd step and filter the files you wanna get, remove the other columns and expand the rows...so you will get a column with the sheet name.

 

Ricardo



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Thanks but not sure if I was understood.

 

The xls I am loading is called Excel1.xls and its sheet is called Table1.

 

The table it contains is:

Header1Header2Header3
rkf
obr
evp

 

I want to create a table like this:

Header1Header2Header3NewColumn1NewColumn2
rkfTable1Excel1
obrTable1Excel1
evpTable1Excel1

 

How can I do that?

 

Thanks!

@UsePowerBI ,

 

Check this file: Download PBIX 

 

Just go to Transform Data and edit the parameter for path.

 

Ricardo



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



amitchandak
Super User
Super User

@UsePowerBI , Example of moving data from one table to another

New column in table1

New Column = maxx(filter(table2,table2[Col1]= table1[col1] && table2[Col2]= table1[col2] ),table2[required_col])


New column in Table 1 = maxx(filter(table2,table1[customer] = table2[customer] && table2[option]="construction",table2[value])

New column in Table 1 = maxx(filter(table2,table1[Attribute] = table2[name] && table1[project] = table2[project]),table2[name])

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.