Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

column dynamic language translation

Hi,

we have the following dataset, in this dataset there are months in different languages, these should be translated into German if possible.

 

 

A quite simple implementation is possible with python, is there a solution to solve this challenge, using PBI standard functions?

 

Best, 

Cornelius

  • Hi Anonymous ,

    If you want to use DAX function to achieve it, you need to create a Table including different months from different regions, and a Germany month column like this:

    Then you can create a calculated column in the source table to 'translate' the month column:

    Germany month translation =
    IF (
        'Table'[Month] IN DISTINCT ( 'Month'[Germany month] ),
        [Month],
        LOOKUPVALUE ( 'Month'[Germany month], 'Month'[Month], 'Table'[Month] )
    )
    

    Attached a sample file in the below, hopes to help you.

     

    Best Regards,
    Community Support Team _ Yingjie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

5 Replies

  • v-yingjl's avatar
    v-yingjl
    Community Support

    Hi Anonymous ,

    If you want to use DAX function to achieve it, you need to create a Table including different months from different regions, and a Germany month column like this:

    Then you can create a calculated column in the source table to 'translate' the month column:

    Germany month translation =
    IF (
        'Table'[Month] IN DISTINCT ( 'Month'[Germany month] ),
        [Month],
        LOOKUPVALUE ( 'Month'[Germany month], 'Month'[Month], 'Table'[Month] )
    )
    

    Attached a sample file in the below, hopes to help you.

     

    Best Regards,
    Community Support Team _ Yingjie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Anonymous 

    Unfortunately, there is no option or function in DAX to perform the translation as you desire but, you can try the Run Python Script option in Power Query under the transform tab to incorporate your Python code for translation.

    ________________________

    If my answer was helpful, please click Accept it as the solution to help other members find it useful

    Click on the Thumbs-Up icon if you like this reply 🙂


    Website YouTube  LinkedIn

  • Hi Anonymous 

    You can use lookup values in a Record to do the translation in Power Query.  You could also use another table and do a join on the month name, but the lookup using a record I think would be easier.

     

     

    let
        Months = [ 
                    JANUARY = "Januar", 
                    FEBRUARY = "Februar",
                    MARCH = "März",
                    APRIL = "April",
                    MAY = "Mai",
                    JUNE = "Juni",
                    JULY = "Juli",
                    AUGUST = "August",
                    SEPTEMBER = "September",
                    OCTOBER = "Oktober",
                    NOVEMBER = "November",
                    DECEMBER = "Dezember",
    
                    JANUARI = "Januar", 
                    FEBRUARI = "Februar",
                    MAART = "März",
                    // APRIL
                    MEI = "Mai",
                    JUNI = "Juni",
                    JULI = "Juli",
                    AUGUSTUS = "August",
                    //SEPTEMBER
                    OKTOBER = "Oktober"
                    //NOVEMBER
                    //DECEMBER
                ],
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8irNS1WK1QExcirBDMfS9NLiEjAzOLWgJDU3KbUIoiIxrzSxKBPMdktNKoJzfBMTiyAaHAuKMnMgYqlAuVgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Month = _t]),
        #"Added Custom" = Table.AddColumn(Source, "NewMonth", each Record.Field(Months, Text.Upper([Month])))
    in
        #"Added Custom"

     

     

    Where a month has already been listed in another language, I've left a commented out line (Apr, Sep, Nov and Dec in Dutch).

    I'm using Text.Upper([Month]) to ensure the match is case insensitive.

    Regards

    Phil

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi everyone,

     

    Here you find tool for reports (.pbix) translation - Power Translate! Very clear and easy to use, moreover the tool has been verified by MS AppSource.

     

    Power Translate — an indispensable tool that will help you translate display elements (such as titles, headers, name of measures) placed in the Power BI created reports.

     

    Here you can find also video with instruction - AppSource - Power Translate.