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
powerbinovice22
New Member

Measure to count the number of unique customers in 2 columns

I’m having trouble creating a measure to add up the number of unique names in 2 columns

 

Column 1:

Sam

Tyler

John

Peter

Kate

Jack

 

Column 2:

Tyler

Bruce

Jack

Kate

Teresa

Tyler

 

The measure should output the number 8 since there are 8 unique customers (Sam, Tyler, John, Peter, Kate, Jack, Bruce, Teresa)

1 ACCEPTED SOLUTION

Hi, @powerbinovice22 

 

You can try the following methods.

Measure:

Measure =
VAR _table =
    DISTINCT ( UNION ( ALL ( 'Table'[Column 1] ), ALL ( 'Table'[Column 2] ) ) )
RETURN
    COUNTROWS ( _table )

Result:

vzhangti_0-1665457589224.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@powerbinovice22 , if you just need to count

 

countrows(Summarize(Union(all(Table[Column1]), Table[Column2])) )

 

Other wise you need to have common dimension to display name

I tried this but the second column could not be selected so I tried 

 

countrows(Summarize(Union(all(Table[Column1]), all(Table[Column2])) ))

 

but got an error that too few arguments were passed to the summarize function. 

Hi, @powerbinovice22 

 

You can try the following methods.

Measure:

Measure =
VAR _table =
    DISTINCT ( UNION ( ALL ( 'Table'[Column 1] ), ALL ( 'Table'[Column 2] ) ) )
RETURN
    COUNTROWS ( _table )

Result:

vzhangti_0-1665457589224.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.