Forum Discussion
Distinct Count of Two Columns
- 9 years ago
Hi Simon_Nuss,
Currently I don’t think only using measure could achieve this.
In addition to concatenate those two columns, we could create a special column to mark the same value in those two columns.
Then use the two distinct value to minus the sum of the same value column, take use of your example here:
Create the calculated column with the following formula:
Samevalue = if(
LOOKUPVALUE( Table1[Gold], Table1[Gold], Table1[Sliver] ) <> BLANK(),
1,
0)
Modify the count measure with the following:
Measure := DISTINCTCOUNT(Table1[Gold])+DISTINCTCOUNT(Table1[Sliver])-calculate(DISTINCTCOUNT(Table1[Sliver]), Table1[Samevalue]=1)
See the result:
Hope this should be helpful.
Regards
Hi Simon_Nuss,
Currently I don’t think only using measure could achieve this.
In addition to concatenate those two columns, we could create a special column to mark the same value in those two columns.
Then use the two distinct value to minus the sum of the same value column, take use of your example here:
Create the calculated column with the following formula:
Samevalue = if(
LOOKUPVALUE( Table1[Gold], Table1[Gold], Table1[Sliver] ) <> BLANK(),
1,
0)
Modify the count measure with the following:
Measure := DISTINCTCOUNT(Table1[Gold])+DISTINCTCOUNT(Table1[Sliver])-calculate(DISTINCTCOUNT(Table1[Sliver]), Table1[Samevalue]=1)
See the result:
Hope this should be helpful.
Regards
Michel well - I'm seeing Marco Russo this evening so I know what I'll be asking him. Thanks for your help mate!
- v-micsh-msft9 years agoMicrosoft Employee
Hi Simon_Nuss,
Do you need any further assistance on this topic?
Regards
- Anonymous9 years agoNot applicable
No thanks, I actually forgot to ask Marco - oh well! I'll revisit it in a few weeks and try to think of an elegant solution.