It takes a nested list of old and new column names as its second argument. The largest, in-person gathering of Microsoft engineers and community in the world is happening April 30-May 5. Now all the needs to be done is to apply this zipped list . For each trimmed column name, look up the value in the first row of that column (which should give you a list of 5 different strings, which will be the new column names). this looks like a bug - you should send a frown" [, "Once the column name changes the report breaks because it's expecting the previous column name" [, Dynamically updating column names based on a mapping table, How to Get Your Question Answered Quickly. The dropdown listbox to the left of the formula bar should now say Format, and the formula in the formula bar should have a format string. And Index column not support the Direct Query Mode. Change column name Dynamically on visuals in Power BI. We can use a function called Table.ColumnNames() for this. Thanks, that video makes much more sense! In my data I want the data to be distributed by date so I have selected date Column. Dynamically change column names in Power Query using - antmanbi However, when you rename columns through some dynamic logic, this mechanism isn't triggered and the column references in reports are broken. These are retrieved from the Internationalization table: Remember that each title on the Dynamic column header data role will be associated to the Dynamic column column value field that shares the same data role index. Date.FromText() will take the date in the first row and convert 11/20/2020 to a real date. Lets explain the most important parts about the script so far: As a side note, the same could be achieved by using Table.ColumnNames() function which would give us a list of all table column names. Can you clarify on "Dimension" being the previous step of the code? This is so Power Query will generate the Table.RenameColumns() step for us and we will make minor tweaks. Short story about swapping bodies as a job; the person who hires the main character misuses his body. Connect and share knowledge within a single location that is structured and easy to search. Hypothetically, if I had a slicer based on Seasons of the year, I would want my columns to reflect the names of the month in that season. Many thanks for your help. Which language's style guidelines should be used when writing code that is supposed to be called from another language? In all other rows, it returns errors. Power Query indexes at zero, so {0} would return the first item. Sometimes though the column you are renaming can have different names with each refresh, so this method wont work. The Source step of the inner environment (environment of the ListObjectWithCleaningLogic variable) should also point to the function input variable. Change column names dynamically with parameters in Power BI Were you able to get the correct answer? Sometimes though the column you are renaming can have different names with each refresh, so this method won't work. From here, you can type in the new column name, and click "Ok" when done. In my example, here's my code for MyFuncRenameColumns: Here's where you use it as one of the parameters for Table.TransformColumnNames: Thanks for contributing an answer to Stack Overflow! 3- Create relationship between both datasets on the basis of Index. Otherwise I think you need to clarify your question for DAX/Report experts. We can use a List in Power Query to make this dynamic. Dynamically Changing the Field/Column Name Based on Value of Other Column Now we have this: Both the 2nd and 3rd column need to be renamed, and we cannot double-click to rename, otherwise the refresh will fail tomorrow when the date changes to Nov 21, 2020. Making statements based on opinion; back them up with references or personal experience. In all other rows it will return errors, because there is no spaces in the other rows, and those are numbers, so there is no text to extract. Sadly, the built-in table visualization provided by Power BI does not support this feature, since the header titles can only have a static value: Even so, theres a way to get this feature done and thats by creating our own custom visual. This is how the final product looks: Both the source code of the custom visual and the sample report can be found in this public repository along side with more technical details about how this demonstration was achieved. EXCEED Solutions d.o.o.Drenika 21, 10000 Zagreb, HrvatskaOIB: 25417969805MBS: 081124327IBAN: HR6523600001102641074info@exceed.hr+385 98 9461 471Ured: Modruka 2, 10000 Zagreb. Let's get started and learn how to rename columns like a pro in Power Query. 4. If Department 2 will use my application that time the field names will be A B C which will replace the same Data Table(Table1) field names i.e F1 F2 & F3. Wouldnt be nice to add multilanguage support to our visualization? Let's load both these tables to Power Query!