Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
vvibhakar
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

@vvibhakar

 

May be a MEASURE like

 

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

 


Regards
Zubair

Please try my custom visuals

View solution in original post

3 REPLIES 3
sqlguru448
Helper III
Helper III

please try below

 

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

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

@vvibhakar

 

May be a MEASURE like

 

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

 


Regards
Zubair

Please try my custom visuals

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors