Forum Discussion
trdoan
7 years agoHelper III
Count Distinct from different tables + Find matching values
Hi everyone, Here is my sample data. The 3 sheets are my 3 tables where the "General Info" table has all Store Names and the other 2 tables have several Store Names which have 1-to-many relat...
- 7 years ago
Hi trdoan,
Create the following measures:
Distintc Count Laboratory = IF ( DISTINCTCOUNT ( NDT[Store] ) = BLANK (); 0; DISTINCTCOUNT ( Laboratory[Store] ) ) + 0 Distintc Count NDT = IF ( DISTINCTCOUNT ( Laboratory[Store] ) = BLANK (); 0; DISTINCTCOUNT ( NDT[Store] ) ) + 0 NDT Alternatives Count = IF ( CALCULATE ( COUNT ( NDT[NDT] ); ALLSELECTED ( NDT[NDT] ) ) <> 1; DISTINCTCOUNT ( NDT[Store] ) ) NDT No alternatives = IF ( CALCULATE ( COUNT ( NDT[NDT] ); ALLSELECTED ( NDT[NDT] ) ) = 1; "No alternate Store can do : " & CONCATENATEX ( NDT; SELECTEDVALUE ( NDT[NDT] ); "," ); "Alternative Stores: " & CONCATENATEX ( NDT; NDT[Store]; "," ) )Check PBIX file attach.
Regards,
MFelix
v-juanli-msft
7 years agoCommunity Support
Hi trdoan
I believe MFelix's solution may help you.
I would suggest you to download the lastest version of Power BI which updates with more new features and fixes many issues occured in previous version.
Also it is backwords compatible. so don't worry about previous pbix files, you can use the lastest version to open and manage these.
Best Regards
Maggie
trdoan
7 years agoHelper III
Hi MFelix & v-juanli-msft , thank you for your help! MFelix's answer worked perfectly on my new version!!! Thanks again!!!