Forum Discussion
Count unique/distinct values from two different tables
- 5 years ago
Hi Anonymous ,
Using below dax expression:
Measure = CALCULATE(DISTINCTCOUNT(Visits[Regarding Account]),ALL(Visits))-CALCULATE(DISTINCTCOUNT(Visits[Regarding Account]),FILTER(ALL(Visits),Visits[Regarding Account] in FILTERS(Accounts[Account Name])))And you will see:
For the related .pbix file,pls see attached.
Best Regards,
KellyDid I answer your question? Mark my post as a solution!
Hi!
if the tables have no relationship you can use the treatas function within an calculate function.
The treatas function filters the visitor function from my example by the values from the account name table. Afterwards, only the distinct values are calculated by the measure.
I hope I was able to help you 🙂
Best wishes
Rob
- Anonymous5 years agoNot applicable
Hi Rob! robinHH
Thanks for your contribution.
Unfortunately I receive below error. As I see it we also need to select column for the "account" table. Currently it's just referring to the table but does not point to column 🙂- v-kelly-msft5 years agoCommunity Support
Hi Anonymous ,
Using below dax expression:
Measure = CALCULATE(DISTINCTCOUNT(Visits[Regarding Account]),ALL(Visits))-CALCULATE(DISTINCTCOUNT(Visits[Regarding Account]),FILTER(ALL(Visits),Visits[Regarding Account] in FILTERS(Accounts[Account Name])))And you will see:
For the related .pbix file,pls see attached.
Best Regards,
KellyDid I answer your question? Mark my post as a solution!