Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
UPF1KOR
Regular Visitor

Creating dynamic values Translation by Translation Builder

Hi,

I am using Translation builder to create Trnaslation for visual lables. However, one label is dynamic means, it gets created based on selection in the PIE chart. Below is the code for you to refer. Problem is, how can I translate this in multiple languages or pass as parameter to Tranlsation builder? 

M_TITLE =
VAR _LD_Selection =
    IF (
        ISFILTERED ( 'Table'[Value1] ),
        COUNTROWS ( VALUES ( Table'[Value1] ) ),
        0
    )
RETURN
    IF (
        _LD_Selection <> 0,
        CONCATENATE (
            CONCATENATE (
                "Deviation Duration (in hrs) on L2 [Within ",
                SELECTEDVALUE ( 'Table'[Value1] )
            ),
            "]"
        )
1 ACCEPTED SOLUTION
v-jianpeng-msft
Community Support
Community Support

Hi, @UPF1KOR 

Translation Builder may not provide dynamic tag translation. There are two ways to do this:

Here's my sample data:

Table:

vjianpengmsft_0-1714445147242.png

LanguageTable:

vjianpengmsft_1-1714445180490.png

TranslationsTable

vjianpengmsft_2-1714445220616.png

Use the following DAX expressions:

M_TITLE_TRANSLATED = 
VAR _LD_Selection =
    IF (
        ISFILTERED ( 'Table'[Value1] ),
        COUNTROWS ( VALUES ( 'Table'[Value1] ) ),
        0
    )
VAR _seleted_value1 = SELECTCOLUMNS('Table',"Value1",'Table'[Value1])
VAR _seleted_code = SELECTEDVALUE(LanguageTable[code])
VAR _English = IF (
        _LD_Selection <> 0,
        CONCATENATE (
            CONCATENATE (
                "Deviation Duration (in hrs) on L2 [Within ",
                LOOKUPVALUE(TranslationsTable[English],'TranslationsTable'[value],_seleted_value1)
            ),
            "]"
        ))
VAR _Spanish = IF (
        _LD_Selection <> 0,
        CONCATENATE (
            CONCATENATE (
                "Deviation Duration (in hrs) on L2 [Within ",
                LOOKUPVALUE(TranslationsTable[Spanish],'TranslationsTable'[value],_seleted_value1)
            ),
            "]"
        ))
VAR _Chinese = IF (
        _LD_Selection <> 0,
        CONCATENATE (
            CONCATENATE (
                "Deviation Duration (in hrs) on L2 [Within ",
                LOOKUPVALUE(TranslationsTable[Chinese],'TranslationsTable'[value],_seleted_value1)
            ),
            "]"
        ))
RETURN SWITCH(_seleted_code,
    1, _English,
    2,_Spanish,
    3,_Chinese)

Use this measure in the card visual. To simulate the dynamics, I put the value1 in the Table into a slicer. At the same time, create a slicer using the code in the LanguageTable, and select dynamic translations according to the different users:

vjianpengmsft_3-1714445563909.png

vjianpengmsft_4-1714445621847.png

vjianpengmsft_5-1714445637575.png

You can also consider using Azure AI Translator. You can refer to the following articles to learn how to use:

Building a multi-language Semantic Model and Report using Translations Builder + Azure AI Translator...

vjianpengmsft_6-1714445762284.png

The above similar effect with DAX is for your reference only, you need to make appropriate adjustments according to your actual situation. I've provided the PBIX file used this time below.

 

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
UPF1KOR
Regular Visitor

Hi @v-jianpeng-msft ,

Thanks a lot for the detailed guide. Your idea is good. Only challenge I see with this approach is the complexity of the DAX query when the number of Language increases. With 4 or 5 languages, Its good. With 31 languages (as in my case) its gonna be a darn hectic query! 
But I appreciate your time & letting me the path to persue. Thanks.

v-jianpeng-msft
Community Support
Community Support

Hi, @UPF1KOR 

Translation Builder may not provide dynamic tag translation. There are two ways to do this:

Here's my sample data:

Table:

vjianpengmsft_0-1714445147242.png

LanguageTable:

vjianpengmsft_1-1714445180490.png

TranslationsTable

vjianpengmsft_2-1714445220616.png

Use the following DAX expressions:

M_TITLE_TRANSLATED = 
VAR _LD_Selection =
    IF (
        ISFILTERED ( 'Table'[Value1] ),
        COUNTROWS ( VALUES ( 'Table'[Value1] ) ),
        0
    )
VAR _seleted_value1 = SELECTCOLUMNS('Table',"Value1",'Table'[Value1])
VAR _seleted_code = SELECTEDVALUE(LanguageTable[code])
VAR _English = IF (
        _LD_Selection <> 0,
        CONCATENATE (
            CONCATENATE (
                "Deviation Duration (in hrs) on L2 [Within ",
                LOOKUPVALUE(TranslationsTable[English],'TranslationsTable'[value],_seleted_value1)
            ),
            "]"
        ))
VAR _Spanish = IF (
        _LD_Selection <> 0,
        CONCATENATE (
            CONCATENATE (
                "Deviation Duration (in hrs) on L2 [Within ",
                LOOKUPVALUE(TranslationsTable[Spanish],'TranslationsTable'[value],_seleted_value1)
            ),
            "]"
        ))
VAR _Chinese = IF (
        _LD_Selection <> 0,
        CONCATENATE (
            CONCATENATE (
                "Deviation Duration (in hrs) on L2 [Within ",
                LOOKUPVALUE(TranslationsTable[Chinese],'TranslationsTable'[value],_seleted_value1)
            ),
            "]"
        ))
RETURN SWITCH(_seleted_code,
    1, _English,
    2,_Spanish,
    3,_Chinese)

Use this measure in the card visual. To simulate the dynamics, I put the value1 in the Table into a slicer. At the same time, create a slicer using the code in the LanguageTable, and select dynamic translations according to the different users:

vjianpengmsft_3-1714445563909.png

vjianpengmsft_4-1714445621847.png

vjianpengmsft_5-1714445637575.png

You can also consider using Azure AI Translator. You can refer to the following articles to learn how to use:

Building a multi-language Semantic Model and Report using Translations Builder + Azure AI Translator...

vjianpengmsft_6-1714445762284.png

The above similar effect with DAX is for your reference only, you need to make appropriate adjustments according to your actual situation. I've provided the PBIX file used this time below.

 

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.