Forum Discussion
saurabhtd
Resolver II
3 years agoNeed 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...
saurabhtd
Resolver II
3 years agoThanks for replying. Now when I select particular country in filter I am getting required answer. But how to get deafult condition which is to calculate distinctcount(customer code) when all the countries 'A','B','C' are selected in the filter. I am strucked at this point now.
tamerj1
Community Champion
3 years agosaurabhtd
I believe this should be fully dynamic therefore no need for default value.
=
VAR SourceN =
SELECTCOLUMNS (
VALUES ( TableName[CountryName] ),
"@Country", SWITCH ( TableName[CountryName], "A", "X", "B", "X", "C", "Z" )
)
RETURN
CALCULATE (
DISTINCTCOUNT ( TableName[customercode] ),
TableName[SourceName] IN SourceN
)