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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Dynamically select a list for Table.RenameColumns

Hi Folks

It is possible to pass a value as a variable (no parameters please) from Power BI to Power Query? 

Here the context:

I have a few tables (7) which I want to translate the column names depending on the user's selection and let's say I have 1 list for each of headers translated in English, Spanish and French (https://www.youtube.com/watch?v=JJryD2dXVVw) I want to be able to select a specific list (with the translated names) depending on the selected language in Power BI. I DON'T want to use parameters as per the original process because we believe it is not user friendly (Especially when the report gets published to the Service)

How do I make the second parameter in Table.RenameColumns dynamic?

---------

Countries_Sheet = Source{[Item="Countries",Kind="Sheet"]}[Data],
#"Promoted Headers" = Table.PromoteHeaders(Countries_Sheet, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"CountryID", Int64.Type}, {"CountryName", type text}, {"CountryISOCode", type text}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type",Country_HeadersFRENCH)

-----------

it is possible to pass that as a value?

I am aware that when I do switch (update) column names my visualizations will break but I will be toggling between visualizations (using Bookmarks & the Selection panel) but I want to deal with one problem at a time. could you please help? 

 

TIA!!!! really!

 

3 REPLIES 3
Anonymous
Not applicable

close but not yet there. The first link works only with the PBI desktop and we definitely need to make it work in the service.

I also checked the video and it basically uses parameters to translate the metadata.

I have nailed down a solution but need to be able to identify the user id in Power Query 😞 but the following approach wont work because I don't think the local user will work in powerbi.com

https://community.powerbi.com/t5/Power-Query/Get-username-in-Power-Query/td-p/972626

 

Any ideas on how I can read the value of a measure in Power Query? is there any way to hack or fake a measure (

USERPRINCIPALNAME()) as a column visible in PQ? I read somewhere that it might be possible to do some sort of transform to transpose this as a column?
the reason why is because I have a SQL server table in PQ as follows: 
[User ID] [Language Saved]
John.Doe, English
Francoise.Effeil, French
Carlos.Sanchez, Spanish
 
I thought of saving the user Id in another table (let's say John.Doe) and filter the first table my merging the two tables and get a table like:
UserID, Language
John.Doe, English.
 
Since I am now able to use "English" to change the columns to English. any suggestions on how I can get the user name in M or filter the table for the currently logged user in the Service? Highly appreciated!
amitchandak
Super User
Super User

@ImkeF , any advice on that.

Hi @Anonymous ,
there is no solution for exact this behaviour that would also work in the Power BI service. 
(There is a hack for Power BI Desktop, but this will not work in the service: https://www.thebiccountant.com/2017/03/22/use-slicers-for-query-parameters-in-powerbi/)

If you have Power BI Premium, you can use XMLA endpoints for multilanguage solutions.

Also, please check out this video: https://www.csgpro.com/blog/2019/01/multi-language-support-capabilities-in-power-bi/ 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.