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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
TechR21
Helper V
Helper V

Replacing column names with dynamic values from another table

Hello,

 

I have following data and tables.

 

 Tables "ticketsfirsttab", "phonefirsttab", and "phonesecondtab" containing data about tickets, and (phone)numbers

TechR21_1-1671546577138.png

 

 

 

Table "details" contains some metadata including the title of the fields referenced in previous tables:

TechR21_3-1671545335734.png

 

What I'd like to be able to do is query data from the first 3 tables using the Title values from details table. These title values in table "details"can change in future so Im looking for a dynamic solution and not hard coded.

 

So it should be something like this:

TechR21_0-1671546498839.png

 

I tried with rename columns but cant seem to make it work. Also because I need to pick the correct value based on the group in the details table.

 

Any idea?

 

5 REPLIES 5
SamInogic
Super User
Super User

Hi,

As per our understanding, you want dynamic Columns where Column name should change based on another Tables Columns Values.

In order reproduce your requirement we have created two test Tables , Table1 and Table 2 as shown in the below screenshot,

 

SamInogic_0-1671600691003.png

Then Navigate to Power Query Editor where add first column as Fieldname,

SamInogic_2-1671600483799.png

For the Table2 open Advanced Editor and Insert below this line with Source Variable,

 

 #"Renamed Columns" = Table.RenameColumns(#"Source",Table.ToRows(Table1))    

in

    #"Renamed Columns"

SamInogic_3-1671600497894.png

SamInogic_4-1671600509446.png

 

Now when we change the Column FCODE to FCode changed this will automatically reflect changes in another table header as well.

 

SamInogic_5-1671600521776.png

 

 

SamInogic_7-1671600538374.png

 

If this answer helps, please mark it as Accepted Solution so it would help others to find the solution.

 

Thanks!

Inogic Professional Services

An expert technical extension for your techno-functional business needs

Power Platform/Dynamics 365 CRM

Drop an email at crm@inogic.com

Service:  http://www.inogic.com/services/ 

Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

Inogic Professional Services: Power Platform/Dynamics 365 CRM
An expert technical extension for your techno-functional business needs
Service: https://www.inogic.com/services/
Tips and Tricks: https://www.inogic.com/blog/

when adding the renamed columns line i get following error:

TechR21_0-1671611098471.png

 

i managed to get rid of the error but I dont have any result after, still the same column names

 

TechR21_1-1671611736937.png

 

Mahesh0016
Super User
Super User

#"Renamed Columns" = Table.RenameColumns(Source , Table.ToRows(Table.SelectColumns(Table.AddColumn(Table2, "ID2", each "customfield_" & Text.From([ID])) , {"ID2", "cfname"})) , MissingField.Ignore)

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

Doesnt work. Doesnt give an error message but I dont see any results

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors