Visuals translations Power BI reports

Automatic translation of visuals labels

Automatic translation of visuals labels in Power BI reports is possible using conditional formating, Tabular Editor and an Excel template. At the moment, labels are mostly titles. In the future, other labels will be translatable as soon as they will accept conditional formating (visual header tooltip, legend name, …).

Please watch this 4 mn video for an overview of the translation solution :

Step 1 : Install the Excel plugin

  • Open the Excel file
  • A new tab “T-BI-P” appears

  • Select the “Visuals” sheet

Step 2 : Load and translate labels in the Excel file

  • Click on “Power BI desktop file” button and select the pbix or pbit file
  • Click on “Load visuals” button so the plugin scans the report and populates the Excel sheet with its labels. Did you notice new labels are coloured in yellow ? I will explain it further in another post. The “Visual name” column contains the visuals id. The green column contains the labels text. This is your reference text which will be used as the source text for automatic translation
  • Then you need to set the “Localization codes” with the sames codes you have in tabular editor
  • Select “Translation languages” with the dropdown list
  • Fill in the “Validators”. This is not mandatory but might be useful in case different people will validate translations
  • Copy visuals labels into “Visual name” column. Even though this step is optional, it helps naming the measures in a readeable way
  • Select a cell in the column to translate and click on the “Translate all lines” button to translate labels automatically
  • Take care to validate translations or to ask validators to do it for you
  • Then click on “Save labels” button. This will create the “TE objects.tsv” file. It will be used by Tabular Editor. A tsv file is a text file containing data separated by a tab character

Step 3 : Create measures in Tabular editor

The file created by the plugin will be used to create measures automatically in Power BI desktop using Tabular Editor.

Tabular Editor is a powerful tool for tabular model edition created by Daniel Otykier : https://tabulareditor.com/
Detailed presentation : https://powerbi.tips/2020/04/tabular-editor-rocks/

As the enhanced metadata format was in preview until september 2020, you might need to activate this feature in Power BI desktop settings under Options / Global / Preview features.

As long as the XMLA endpoint has writing limitations you need to activate this option in Tabular Editor’s preferences.

Please be careful using it and work only on copies of your reports. I suggest you activate these options carefully after tests and backups.

However, you can create measures manually or in an existing table until the XMLA endpoint will have no limitations.

Open a model in Tabular Editor. Please check it’s documentation in the wiki of the GitHub repository : https://github.com/otykier/TabularEditor/wiki

The script “Create visuals translations measures.csx” will create measures automatically into the model. It can be loaded into Tabular editor this way :

  • Open “Advanced Scripting” tab
  • Click on the “Open a C# script from a file”
  • Review the parameters in the script
  • Click on “+” button
  • Give a name to the custom action and check at least the “Model” checkbox then click “Ok” button
  • Click on the “Play” button when you want to execute the script or right click on the “Model” in the tree and select “Custom actions/your custom action name”
  • Redo all these steps each time you get a new version of the script !

You noticed the “Method” parameter allows to select a method between “USERCULTURE” and “SLICER”. Be sure to read this post to understand the method which is more appropriate for your use case : https://thebipower.fr/index.php/2020/05/07/visuals-labels-translations-in-power-bi-reports/
The pbix file contains examples of both methods.

When you execute the “Create visuals translations measures” script, visuals labels are read from the “TE objects.tsv” file. For each label, a measure is created by Tabular Editor.

Save modifications to the model.

Step 5 : Modify visuals labels in Power BI desktop

Follow the steps in the following post and use the Excel file as a source for translations : https://thebipower.fr/index.php/2020/05/07/visuals-labels-translations-in-power-bi-reports/

Conclusion

Automatic translation of visuals labels in Power BI reports makes the translation process much easier. In an other post, I explain how to manage the translations life cycle. This way, you will be able to maintain translations easily when the report will evolve (visuals creation or deletion).

See also a post about automatic translation of tabular model (columns and measures names) : https://thebipower.fr/index.php/2020/04/12/automatic-translation-of-tabular-model/

12 Comments

  1. Hi Didier,
    awesome post!
    Everything works fine until I click on “Play” in the table editor. Then I get the following error message: “The action failed with the following error: Adding Calculated Tables to this Power BI model is not supported.”
    Do you have any idea what could be the reason for this?

    Thank you very much and best regards

    1. Hello Max,
      It seems to be an issue of Tabular Editor or of your script.
      Do you use the latest version of Tabular Editor ?
      Can you share your script so I can give it a try ? Please use the contact form in this website.
      Regards
      Didier

  2. Thanks for the excellent post. What I understand the automated path of tabular editor cannot be used as yet. So in order to achieve translated text one had to write manual DAX for each visual header in a dashboard. Will explore your excel option to achieve this. Thanks.

    1. Hello Triparna,
      Thanks ! Tabular Editor can be used now to create the measures. It is a huge time saver.
      To achieve it you need to activate XMLA endpoint in your Power BI desktop options. But XMLA endpoint is a preview feature with some cons which have been explained by Imke Feldmann (the link is in the post). So you can test the solution with a test report and it will work now. If you use your production report, make a backup of the report before you activate XMLA endpoint and be carefull of side effects. You might switch back XMLA option to off so your next reports will not be recorded in the new format.
      At the moment, you will still need to go through your visuals to modify the conditional formating.
      Regards

  3. Hi Didier,

    This looks awesome and is exactly what I am looking for. But it seems the Excel add-in won’t work on my machine. I can load the path of the example PBIX file located on my desktop but then nothing happens when I click on “Load visuals” except from cell D6 becoming grey. Would you have any idea of the issue?

    Thanks for the great inspiring and helpful work you are doing.

    Yannick

    1. Hello Yannick,
      Thanks a lot.
      I have no idea why it doesn’t work on your machine. It must work at least with the example PBIX file. Did you modify it; I mean did you save it again ? What is your Power BI desktop version ? Is it the one from the store ? Is it the report server one ?
      I will developp the same functionality in Power BI Sidetools with a log to better understand issues.
      https://thebipower.fr/index.php/power-bi-sidetools/
      Regards
      Didier

      1. Hello Yannick,
        Thank you for the detailed bug report and thank you to help me to make the tool better.

        – InteropServices.COMException :
        I issued a new version. Please install it and tell me

        – I cannot create measures in the PBIX file :
        I updated the post
        Did you activate this option in Tabular Editor’s preferences ? : “Allow unsupported Power BI features (experimental)”
        Do you have an error ? I suppose the reason is it’s not supported yet to create calculated tables with XMLA endpoint. “Not supported” means it will work or not.
        Have a look at this page : https://docs.microsoft.com/fr-fr/power-bi/create-reports/desktop-external-tools

        Otherwise, replace this lines of Tabular Editor’s script (more secured way) :
        // Delete the target table to build it again from scratch
        if (Model.Tables.Contains(Target_table_name)) {
        Model.Tables[Target_table_name].Delete();
        }
        Model.AddCalculatedTable(Target_table_name, @”DATATABLE(“”Fake column”” , INTEGER , {{0}})”);
        var Target_table = Model.Tables[Target_table_name];
        Target_table.Description = “This table is auto generated by a Tabular Editor script…
        Target_table.SetAnnotation(“VTAUTOGEN”, “1”); //…

        by this one :
        Target_table_name = “an existing table name which will host the measures”
        var Target_table = Model.Tables[Target_table_name];

        FYI : The tool collects the visual titles (not headers)

        Regards

  4. Hi There

    I am trying to veiw the sheets in the excel file: Readme, Model and Visuals. When I run the script from within the tabular editor, Excel opens but without those tabs…

    Can you please help?

  5. Hello,
    It seems Excel is launched with an incorrect parameter.
    Please tell me how you modified these lines in the Tabular editor script according to the location of the Excel file ?
    var Objects_file = @”C:\Users\yourusername\Desktop\PBI translations\TE objects.tsv”;
    var Excel_file = @”C:\Users\yourusername\Desktop\PBI translations\PBI translations.xlsm”;

    Openning the Excel file from Tabular Editor is optional. You can comment this line and open the file manually:
    //using(System.Diagnostics.Process.Start(Excel_file));

Leave a Reply

Your email address will not be published. Required fields are marked *