Forum Discussion

DiegoCorriendo's avatar
DiegoCorriendo
Frequent Visitor
7 years ago
Solved

Internationalize Legends in graphs

Hi,

Is it possible to change dynamically legends in graphs as what is done with titles in this example?.

https://powerbiuniversity.com/informes-multilenguaje-formato-condicional-los-titulos/

What i need is to change legend names dinamically in the same way the title does. This is, when "es" is selected, Legend names turn into Spanish language.

 

And when "en" is selected the value shown was in English language.

 

Please help.

 

Thanks in advance and Regards.

  • v-frfei-msft's avatar
    v-frfei-msft
    7 years ago

    Hi DiegoCorriendo ,

     

    We can create a calculated column in the fact table as below to get another language for label.

     

    es = 'Table'[legend] &" es"

    Then I enter a table like this.

     

    Based on the table, to create another two calculated table.

    en = FILTER(lan2,lan2[language] = "en")
    esf = FILTER(lan2,lan2[language]="es")

    To create realationship between tables like this.

     

    After that, we can achieve our goal by a measure.

     

    Measure =
    VAR a =
        MAX ( lan2[language] )
    RETURN
        IF (
            a = "en",
            CALCULATE (
                SUM ( 'Table'[value] ),
                USERELATIONSHIP ( 'Table'[legend], en[lenegdlan] )
            ),
            IF (
                a = "es",
                CALCULATE (
                    SUM ( 'Table'[value] ),
                    USERELATIONSHIP ( 'Table'[es], esf[lenegdlan] )
                )
            )
        )
    

     

3 Replies

  • v-frfei-msft's avatar
    v-frfei-msft
    Community Support

    Hi DiegoCorriendo ,

     

     We can set conditional formatting of tile like this. Then we can change the tile name and legend as we excepted.

     

     

    • DiegoCorriendo's avatar
      DiegoCorriendo
      Frequent Visitor

      Hi  and thanks for quick response.

      I think maybe i don't have expressed correctly my problem.

      What I need to translate are Legend values (Label, Label2 in graph) depending on value selected for the language.
      That is, for "en" (English) value in the selection List it should be shown Label, Label2, but for "es" (Spanish) value or whatever, it should be shown it correspondant value in that language.

      Title is already using conditional formatting as u point.

      Thanks in advance.

      Regards.

      • v-frfei-msft's avatar
        v-frfei-msft
        Community Support

        Hi DiegoCorriendo ,

         

        We can create a calculated column in the fact table as below to get another language for label.

         

        es = 'Table'[legend] &" es"

        Then I enter a table like this.

         

        Based on the table, to create another two calculated table.

        en = FILTER(lan2,lan2[language] = "en")
        esf = FILTER(lan2,lan2[language]="es")

        To create realationship between tables like this.

         

        After that, we can achieve our goal by a measure.

         

        Measure =
        VAR a =
            MAX ( lan2[language] )
        RETURN
            IF (
                a = "en",
                CALCULATE (
                    SUM ( 'Table'[value] ),
                    USERELATIONSHIP ( 'Table'[legend], en[lenegdlan] )
                ),
                IF (
                    a = "es",
                    CALCULATE (
                        SUM ( 'Table'[value] ),
                        USERELATIONSHIP ( 'Table'[es], esf[lenegdlan] )
                    )
                )
            )