Forum Discussion

saurabhtd's avatar
saurabhtd
Icon for Resolver II rankResolver II
3 years ago
Solved

Need help in DAX Logic

I want to do a calculation of DISTINCTCOUNT(TableName[customercode]) of customers from all three countries. But when I select country from countryname filter these conditions should be satisfied. wh...
  • tamerj1's avatar
    3 years ago

    Hi saurabhtd 
    Please try

    =
    VAR SourceN =
        SWITCH (
            SELECTEDVALUE ( TableName[CountryName] ),
            "A", "X",
            "B", "X",
            "C", "Z"
        )
    RETURN
        CALCULATE (
            DISTINCTCOUNT ( TableName[customercode] ),
            TableName[SourceName] = SourceN
        )