Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Distinct count from multiple tables

Hi all,

 

Here my data model :

 

 

I'd like to get the number of distinct apps (with Cost> 0), whatever the source

 

EXPECTED RESULT in a DAX mesure : 2 (to show this figure into a card chart.)

From now, I get 3 because APP01 is counted twice because it's matching into both sources

 

 

 

 

 I thank you in advance for tips and advice.

 

 

 

 

1 Reply

  • sjoerdvn's avatar
    sjoerdvn
    Icon for Solution Sage rankSolution Sage

    if the mapping table is filtering source1 and source2, try something like this

    App count = COUNTROWS(FILTER(VALUES('MAPPING TABLE'[APPS NAME])
    	,CALCULATE(COUNTROWS(SOURCE1), SOURCE1[Cost]>0) + CALCULATE(COUNTROWS(SOURCE2),SOURCE2[Cost]>0) >0))