Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

How to Change columns name dynamically by selecting the language from slicer

I have a table called ContactInfo which contains this data

 

FirstNameLastNamePhone
EricCraig416-555-0622
KimberlyMorris416-555-0144
AlisaRoss416-555-0580
JordanMoore416-555-0302

 

I have another table which contains EachFieldName and its value in English and French

IDFieldNameLanguage
1FirstNameEN
2LastNameEN
3PhoneEN
4prénomFR
5nom de familleFR
6téléphonerFR

 

Is there any way to change the column name dynamically by selecting the language from the slicer?

If I select FR from the slicer the Grid shows column names in french based on its reference table. 

  • Hi Anonymous ,

    According to your description, here's my solution.

    1.In Power Query, add an index column in the ContactInfo table.

    2.Create a measure.

    Measure =
    IF (
        MAX ( 'Language Table'[FieldName] ) IN { "FirstName", "prénom" },
        MAX ( 'ContactInfo'[FirstName] ),
        IF (
            MAX ( 'Language Table'[FieldName] ) IN { "LastName", "nom de famille" },
            MAX ( 'ContactInfo'[LastName] ),
            MAX ( 'ContactInfo'[Phone] )
        )
    )
    

    3.Put the language column in a slicer, put index column in a matrix row, FieldName column from Language table in the matrix column and the measure in matrix value, get the correct result.

    I attach my sample below for reference.

     

    Best Regards,
    Community Support Team _ kalyj

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

     

2 Replies

  • Hi Anonymous ,

    According to your description, here's my solution.

    1.In Power Query, add an index column in the ContactInfo table.

    2.Create a measure.

    Measure =
    IF (
        MAX ( 'Language Table'[FieldName] ) IN { "FirstName", "prénom" },
        MAX ( 'ContactInfo'[FirstName] ),
        IF (
            MAX ( 'Language Table'[FieldName] ) IN { "LastName", "nom de famille" },
            MAX ( 'ContactInfo'[LastName] ),
            MAX ( 'ContactInfo'[Phone] )
        )
    )
    

    3.Put the language column in a slicer, put index column in a matrix row, FieldName column from Language table in the matrix column and the measure in matrix value, get the correct result.

    I attach my sample below for reference.

     

    Best Regards,
    Community Support Team _ kalyj

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