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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
LucienF38
Helper I
Helper I

Count and write duplicates from a concatenate into a new column

Hello team PowerBI,

 

I have a concatenate column that I have created with the formula "COMBINEVALUES" (see below the formula and the result):

FormulaFormulaResultResult

 

I would like to write in a new column "OK" if it's the first iteration (the earliest in date) and "duplicate" for the duplicates (same concatenate but later in date), as you can see below (sorry for the french ahah) :Capture2.PNG

 

So the question is : Which formula should I use in DAX? 

 

I'd like to precise that all of this data is sorted by date. 

 

Thank you very much for your help in advance !

 

Lucien 🙂 

1 ACCEPTED SOLUTION
Cmcmahan
Resident Rockstar
Resident Rockstar

Sure. Here's a measure that will do that if you have one row selected:

 

Ok/Double = IF( COUNTROWS(FILTER(ALL(Table), Table[Date] < SELECTEDVALUE(Table[Date]) && Table[Concatenate] = SELECTEDVALUE(Table[Concatenate]) ) > 0, "doublon", "ok") 

If you want a calculated column instead, replace SELECTEDVALUE with EARLIER.

View solution in original post

3 REPLIES 3
Cmcmahan
Resident Rockstar
Resident Rockstar

Sure. Here's a measure that will do that if you have one row selected:

 

Ok/Double = IF( COUNTROWS(FILTER(ALL(Table), Table[Date] < SELECTEDVALUE(Table[Date]) && Table[Concatenate] = SELECTEDVALUE(Table[Concatenate]) ) > 0, "doublon", "ok") 

If you want a calculated column instead, replace SELECTEDVALUE with EARLIER.

Anonymous
Not applicable

Hi @LucienF38 ,

 

Please try using these steps:

 

1- Edit queries and add the index column first.

2-change the datatype of index column to whole #

3- apply and save

4- add the column (screenshot below)

 

Capture.PNG

 

5 - and include this formula

 

Column = 
VAR dups= 
CALCULATE(count('Sheet10'[Concatenate]),filter(all('Sheet10'),
[Index]<=EARLIER([Index])
  && [Concatenate]=EARLIER((Sheet10[Concatenate])
  )
)
)
return
IF(dups>=2,"DUPS","OK")

6- when you add this in Table Visualization, make sure, Index column is DO not summarize, ese it will give incorrect output.

my output:

 

Capture135.PNG

 

Thanks,

Tejaswi

Thanks for replying tejaswidmello,

 

The thing is that my data is coming from different tables. I can't do it in Edit Query mode...

 

Do you have a solution in DAX?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Kudoed Authors