cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
vvibhakar Frequent Visitor
Frequent Visitor

Distinctcount for values from multiple colums

Hello,

I am trying to analyse all the sourcing projects. We have 10 different columns for each Vendor and its price. I want to have a measure which shows me distinct count of all the vendors combined. Same vendors could appear in multiple columns due to multiple projects. Please see below the type of data I have. 

So the result should be, 15 distinct Vendors for below example. Any suggestions?

Thanks.

 

Project No.Vendor 1Vendor 1 priceVendor 2Vendor 2 priceVendor 3Vendor 3 price
1ABC97LMN66DEF15
2XYZ24ABC57FLS95
3PQRS26STO66JWB79
4LMN65FRA90FSV39
5DEF64GFR55ABC40
6HIJ80PQRS60LWC72
7ZAC46DEF61PQRS28
1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Distinctcount for values from multiple colums

@vvibhakar

 

May be a MEASURE like

 

Measure =
COUNTROWS (
    DISTINCT (
        UNION (
            VALUES ( TableName[Vendor 1] ),
            VALUES ( TableName[Vendor 2] ),
            VALUES ( TableName[Vendor 3] )
        )
    )
)

 

View solution in original post

3 REPLIES 3
sqlguru448 Regular Visitor
Regular Visitor

Re: Distinctcount for values from multiple colums

please try below

 

= DISTINCTCOUNT(Vendor1) +  DISTINCTCOUNT(Vendor2) +  DISTINCTCOUNT(Vendor3)

Super User
Super User

Re: Distinctcount for values from multiple colums

@vvibhakar

 

May be a MEASURE like

 

Measure =
COUNTROWS (
    DISTINCT (
        UNION (
            VALUES ( TableName[Vendor 1] ),
            VALUES ( TableName[Vendor 2] ),
            VALUES ( TableName[Vendor 3] )
        )
    )
)

 

View solution in original post

vvibhakar Frequent Visitor
Frequent Visitor

Re: Distinctcount for values from multiple colums

I had tried already, but it adds up the distinct count. In the given example, the final value still shows 21.

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Users Online
Currently online: 165 members 1,522 guests
Please welcome our newest community members: