Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

DAX measures not filtering as expected

OK DAX gurus, I am having an issue with a technique I was trying to use to display currency symbols based on slicer selected. Here is my current setup:

 

I have 3 slicer that show our CONTINENT, MARKET, and COUNTRY. I have uploaded the sample data for testing. What I am attempting to do is show the symbol based on the slicer selection. First, I created measures for each slicer to display the symbol based on the selection in the slicer. Here is the DAX for that:

 

country_m = IF(HASONEVALUE ( 'DimLocation'[Country] ), VALUES ( 'DimLocation'[Country Symbol] ), "-")
continent_m = IF(HASONEVALUE ( 'DimLocation'[Continent] ), VALUES ( 'DimLocation'[Continent Symbol] ), "-")
market_m = IF(HASONEVALUE ( 'DimLocation'[Market] ), VALUES ( 'DimLocation'[Market Symbol] ),"-")

 

Then, I created a measure to display on a card visual, which my goal was to show the symbol based on the slicer selection as stated above. 

Label = 
IF (
    ISFILTERED ( 'DimLocation'[Continent] ),
    [continent_m],
    IF (
        ISFILTERED ( 'DimLocation'[Market] ),
        [market_m],
        IF ( ISFILTERED ( 'DimLocation'[Country] ), [country_m], " " )
    )
)

This does not work as intended. As you can see from the below screenshot, you should be seeing the symbol at the country level, but it is showing the market or continent level. 

 

 

  • Anonymous's avatar
    Anonymous
    7 years ago

    Well, I'm a doofus. The solution is to reverse the order of conditions ... simple and solved my problem! 

     

    Label 1 =
    IF (
        ISFILTERED ( 'DimLocation'[Country] ),
        [country_m],
        IF (
            ISFILTERED ( 'DimLocation'[Market] ),
            [market_m],
            IF ( ISFILTERED ( 'DimLocation'[Continent] ), [continent_m], " " )
        )
    )

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous,

     

    This issue should related to your dax formula.


    According to your snapshot, I think all of if statement conditions can passed. If this is a case, it only return first condition result instead output correspond level symbol.

     

    If you confused on coding formula, please share some same data for test and coding formula.

     

    Regards,

    Xiaoxin Sheng

    • Anonymous's avatar
      Anonymous
      Not applicable

      I could not find how to upload a file, so here is a small subset of data that allows for testing. And yes I agree my issue is with the DAX as well. 

       

      ContinentContinent SymbolMarketMarket SymbolCountryCountry Symbol
      EMEA€NORDIC€NORWAYkr
      EMEA€NORDIC€SWEDENkr
      EMEA€NORDIC€DENMARKkr
      EMEA€NORDIC€FINLAND€
    • Anonymous's avatar
      Anonymous
      Not applicable

      Well, I'm a doofus. The solution is to reverse the order of conditions ... simple and solved my problem! 

       

      Label 1 =
      IF (
          ISFILTERED ( 'DimLocation'[Country] ),
          [country_m],
          IF (
              ISFILTERED ( 'DimLocation'[Market] ),
              [market_m],
              IF ( ISFILTERED ( 'DimLocation'[Continent] ), [continent_m], " " )
          )
      )