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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
AudreyPowerBI
New Member

If Duplicate Value In Column vs Distinct Occurrence

Good evening Power BI Community!

 

In the Query Editor, I'm trying to create a new custom column to do the following:

If the data in Column A only occurs once in that column, then show me what is in Column D, if the data point in Column A has a duplication in that column, then produce string "Multiple".

 

Note limitation: Removing duplicates in Column A is not an option in our case.

 

What would you suggest I use as the DAX formula here?

 

Please advise? Thank you kindly,

Audrey

1 ACCEPTED SOLUTION
AudreyPowerBI
New Member

Hello and thank you everyone for your late night help!

It was definitely much appreciated. 😄

 

In case you're wondering, the approach I took that did the trick was as follows:

 

SOLUTION = IF (CALCULATE (HASONEVALUE(SOLUTION[COLUMNB]),ALLEXCEPT(SOLUTION,SOLUTION[COLUMNA]) )=TRUE,SOLUTION[COLUMND],"Multiple")

 

Thank you all and I hope you have a lovely weekend!

Audrey

View solution in original post

5 REPLIES 5
AudreyPowerBI
New Member

Hello and thank you everyone for your late night help!

It was definitely much appreciated. 😄

 

In case you're wondering, the approach I took that did the trick was as follows:

 

SOLUTION = IF (CALCULATE (HASONEVALUE(SOLUTION[COLUMNB]),ALLEXCEPT(SOLUTION,SOLUTION[COLUMNA]) )=TRUE,SOLUTION[COLUMND],"Multiple")

 

Thank you all and I hope you have a lovely weekend!

Audrey

Vvelarde
Community Champion
Community Champion

@AudreyPowerBI

 

Hi,in Query Editor you can do it following these steps:

 

count.gif

 

Let mw know if you need more help

 

Regards

 

Victor

Lima - Peru




Lima - Peru
Ashish_Mathur
Super User
Super User

Hi,

 

Try this

 

=IF(CALCULATE(COUNTROWS(Data),FILTER(Data,Data[Heading1]=EARLIER(Data[Heading1])))>1,"Multiple",Data[Heading])

 

I have assumed that the Table name is Data and heading of column A id Heading1.  Also, the data type of entries in the heading column has been assumed as text.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
TomMartens
Super User
Super User

Hey,

 

this DAX statement creates a calculated column in your table

var whatsincolumnD =  'yourtable'[ColumnD]
return
IF(
CALCULATE(
COUNTROWS('yourtable')
,ALLEXCEPT('yourtable', 'yourtable'[ColumnA])
) >1
,whatsincolumnD
,"Multiple"
)

Hopefully this is what you are looking for

 

Regards

Tom

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Hello Tom,

 

Thank you for taking the time to respond!

I'm not familiar with DAX at all but am wondering, should I still use this formula even though I'm not trying to calculate anything?

 

Audrey

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors