Forum Discussion
Boeboey
1 year agoFrequent Visitor
Filtering on USERCULTURE() if no language has been selected in slicer
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 slec...
- 1 year ago
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] ) ) )
Boeboey
1 year agoFrequent Visitor
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.