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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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 










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


Proud to be a Super User!









"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.










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


Proud to be a Super User!









"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
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors