Forum Discussion
How to Change columns name dynamically by selecting the language from slicer
I have a table called ContactInfo which contains this data
| FirstName | LastName | Phone |
| Eric | Craig | 416-555-0622 |
| Kimberly | Morris | 416-555-0144 |
| Alisa | Ross | 416-555-0580 |
| Jordan | Moore | 416-555-0302 |
I have another table which contains EachFieldName and its value in English and French
| ID | FieldName | Language |
| 1 | FirstName | EN |
| 2 | LastName | EN |
| 3 | Phone | EN |
| 4 | prénom | FR |
| 5 | nom de famille | FR |
| 6 | téléphoner | FR |
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 _ kalyjIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- amitchandak
Super User
Anonymous , There is one solution discussed in detail here, please check if that can help
https://community.powerbi.com/t5/Desktop/Switch-between-Spanish-and-English-naming/td-p/1233340
- v-yanjiang-msft
Community Support
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 _ kalyjIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.