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
Rahul_SC
Helper III
Helper III

Finding common names under a group by Dax

Hi,

 

I have a table like below. I would like find find common names present in the table. 

 

Data structure - the names will name be same under unique ID and under unique sub ID. But it could be same if unique ID and unique sub ID changes. I want common names to be present like the last column as an output using dax. Appreciate your guidance on this.

 

Thanks.

 

Unique IDUnique Sub IDNameCommon Names under unique ID
A1JackJack
A1RajeshRajesh
A1Karan 
A2RajeshRajesh
A2JackJack
A2Ani 
B3Jack 
B3KaranKaran
B4KaranKaran
B4Clark

 

1 ACCEPTED SOLUTION

@Rahul_SC , try like

 

New Measure=

var _cnt = countx(filter(allselected(Table) , [Unique ID] = Max([Unique ID]) && [Name] = Max([Name]) ), [Name])

return

if(_cnt >1, [Name], blank())

 

 

or

 

New Measure=

var _cnt = countx(filter(allselected(Table) , [Unique ID] = Max([Unique ID]) && [Name] = Max([Name]) ), [Name])

return

if(_cnt >1, [Name], "")

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Rahul_SC , Based on what I got

 

New colum =

var _cnt = countx(filter(Table, [Unique ID] = earlier([Unique ID])  && [Name] = earlier([Name]) ), [Name])

return

if(_cnt >1, [Name], blank())

 

Hi @amitchandak ,

 

thanks for responding, can you please create it in measure ? not column. 

@Rahul_SC , try like

 

New Measure=

var _cnt = countx(filter(allselected(Table) , [Unique ID] = Max([Unique ID]) && [Name] = Max([Name]) ), [Name])

return

if(_cnt >1, [Name], blank())

 

 

or

 

New Measure=

var _cnt = countx(filter(allselected(Table) , [Unique ID] = Max([Unique ID]) && [Name] = Max([Name]) ), [Name])

return

if(_cnt >1, [Name], "")

@amitchandak , amazing logic. It works. Thank you.

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