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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Swamy3105
Helper IV
Helper IV

flag the first occurrence in the duplicate values in column

Hi Experts,

 

I need to flag the first occurrence of duplicate values in the column using calculated column.

 

Example:

 

Swamy3105_0-1654859982605.png

Please help me on this. I need a calculated column dax not a measure.

 

Regards.,

Swamy

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @Swamy3105 

Thanks for reaching out to us.

If you want to get the first occurrence, there should be a sequential column(time or numbers, etc. that can represent the sequence) in the table.  

For example,

Flag = 
var _index= CALCULATE(MIN('Table'[Index]),ALLEXCEPT('Table','Table'[Business],'Table'[Year],'Table'[Period]))
return IF('Table'[Index]= _index,1,0)

vxiaotang_0-1655189245234.png

Best Regards,

Community Support Team _Tang

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

View solution in original post

5 REPLIES 5
v-xiaotang
Community Support
Community Support

Hi @Swamy3105 

Thanks for reaching out to us.

If you want to get the first occurrence, there should be a sequential column(time or numbers, etc. that can represent the sequence) in the table.  

For example,

Flag = 
var _index= CALCULATE(MIN('Table'[Index]),ALLEXCEPT('Table','Table'[Business],'Table'[Year],'Table'[Period]))
return IF('Table'[Index]= _index,1,0)

vxiaotang_0-1655189245234.png

Best Regards,

Community Support Team _Tang

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

Swamy3105
Helper IV
Helper IV

Hi Experts,

 

Any idea on the above query?

 

Regards.,

Swamy

Ashish_Mathur
Super User
Super User

Hi,

I can do this in the Query Editor (not in the Data Model with a calculated column).  If you are interested, post back and i can share an M language solution.

Also, since all entries in the first 3 rows are the same, how does one decide which should be the first record?  Is this data incomplete?


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

@Ashish_Mathur 

 

Based on the Business, Year, Period and Cost center we need to flag it.

 

Regards.,

Swamy

Your response does not answer my question.


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

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.