Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi,
I have a table with "production functions" in different languages.
I would like to get the "production functions" in the language that is selected in the slicer or if no slicer value is slected, use the USERCULTURE language.
This is my measure:
SafetyCodes_Language =
var SelectedLanguage = SWITCH(TRUE(),
SELECTEDVALUE('Safety codes (2)'[Language])="en","en",
SELECTEDVALUE('Safety codes (2)'[Language])="fr","fr",
SELECTEDVALUE('Safety codes (2)'[Language])="nl","nl",
SELECTEDVALUE('Safety codes (2)'[Language])="pl","pl",
SELECTEDVALUE('Safety codes (2)'[Language])="ru","ru",
LEFT(USERCULTURE(),2)
)
return CALCULATE(DISTINCTCOUNT('info_HGR unpivoted'[Index]),'Safety codes (2)'[Language]=SelectedLanguage)If a language is selected in the slicer, the filtering is done correctly:
Without selecting any slicervalue, all translations are shown:
When changing the measure to get the USERCULTURE directly, the filtering is also done correctly:
SafetyCodes_Language =
var SelectedLanguage = LEFT(USERCULTURE(),2)
return CALCULATE(DISTINCTCOUNT('info_HGR unpivoted'[Index]),'Safety codes (2)'[Language]=SelectedLanguage)
I don't see why the first measure is not working as expected.
Solved! Go to Solution.
I assume the y axis is from the 'Safety codes (2)' table? In which case there is a single value per row. Try
SafetyCodes_Language =
IF(
ISFILTERED( SELECTEDVALUE('Safety codes (2)'[Language]) ),
// IF filtered show all selected languages
DISTINCTCOUNT( 'info_HGR unpivoted'[Index] ),
// If no filter use user's language
CALCULATE(
DISTINCTCOUNT('info_HGR unpivoted'[Index]),
TREATAS'( { LEFT(USERCULTURE(),2) }, 'Safety codes (2)'[Language] )
)
)
Awesome! Thanks @Deku , it's working now. Made a small adaptation to your code:
SafetyCodes_Language =
IF(
ISFILTERED('Safety codes (2)'[Language]),
// IF filtered show all selected languages
DISTINCTCOUNT( 'info_HGR unpivoted'[Index] ),
// If no filter use user's language
CALCULATE(DISTINCTCOUNT('info_HGR unpivoted'[Index]),'Safety codes (2)'[Language]=LEFT(USERCULTURE(),2))
)Thanks for the quick support.
I assume the y axis is from the 'Safety codes (2)' table? In which case there is a single value per row. Try
SafetyCodes_Language =
IF(
ISFILTERED( SELECTEDVALUE('Safety codes (2)'[Language]) ),
// IF filtered show all selected languages
DISTINCTCOUNT( 'info_HGR unpivoted'[Index] ),
// If no filter use user's language
CALCULATE(
DISTINCTCOUNT('info_HGR unpivoted'[Index]),
TREATAS'( { LEFT(USERCULTURE(),2) }, 'Safety codes (2)'[Language] )
)
)
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 104 | |
| 82 | |
| 68 | |
| 50 | |
| 46 |