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 ...
  • 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] )
                )
            )
        )