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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
lwgpowerbiadmin
Frequent Visitor

Creating report with Dynamic fields

Hi,

Our application is a multi tenancy web app and we are using Custom fields for User table based on the client. Each client can have upto 8 custom fields in which they can define the name for that custom fields. So in In reports (table or matrix) we would like to display the custom field value in header. Please find our use case below. Columns which are marked in Blue color are static columns.

 

lwgpowerbiadmin_0-1647339483743.png

 

lwgpowerbiadmin_1-1647339522645.png

 

Please help us to resolve this issue.

 

Thanks in advance

Madhan

3 REPLIES 3
danextian
Super User
Super User

Hi @lwgpowerbiadmin ,

This can be done in Power Query. You need to maintain a table that contains the columns to be renamed and the new names.  These columns in a table will be converted to a list of lists which will be used in the Table.Renames argument in the  other table instead of hardcoding the new names. Instead of something like this:

= Table.RenameColumns(#"Changed Type",{{"Custom1", "Male"}, {"Custom2", "Email"}, {"Custom3", "Country"}})

 

you do this:

= Table.RenameColumns(#"Changed Type", Names)

 

Here's the link to the sample pbix. Go to the query editor to see the M script. https://drive.google.com/file/d/1iH9LHZkX4OVpfW788_81dGwCEiiMMo1G/view?usp=sharing 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi @danextian 

 

Thnaks a lot for your solutions. This helps us to move further. But we are facing issue while changing the Names list value. Please see below scenario

 

Names list:

Initially we have mapped names like below

Custom1: Gender

Custom2: Email

Custom3: Country

with this list we have creted Table Visual and it is working perfect.

 

Now to simulate the same report for another Client, We have changed the List value (Email to EmailAddress)

Custom1: Gender

Custom2: EmailAddress

Custom3: Country

 

When we close and apply, we are getting below error in Table visual.

 

lwgpowerbiadmin_0-1647416126510.png

 

Basically we are using Embedded Report in our report for all our clients. based on the client Names list will change. Please guide us on this.

 

 

 

 

hI @lwgpowerbiadmin,

I couldn't replicate your error when trying to change the column name manually but did so after modifying the column names mapping which in turn automatically renamed the Email column to  EmailAddress.
It seems that "automatically" renaming a column can cause an error in the visual that uses the original column name.  The simplest solution is to remove that erring column/field and replace it with what it's been renamed to.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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