Forum Discussion

Boeboey's avatar
Boeboey
Frequent Visitor
1 year ago
Solved

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...
  • Deku's avatar
    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] ) 
       )
    )