cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
qsmith83
Responsive Resident
Responsive Resident

Custom Column to show duplicates with condition

As per screenshot, I need a custom column to show duplicates on the JobID+Ticket column, based on the following conditions:

  • if JobID+Ticket contains duplicate, return "Yes" else "No"
  • if TICKET_NBR is blank, return "No"

Screenshot 2021-11-02 182800.jpg

1 ACCEPTED SOLUTION
VahidDM
Super User
Super User

Hi @qsmith83 

 

Try this measure:

Column =
VAR _Disc =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[JOBID+Ticket] = EARLIER ( 'Table'[JOBID+Ticket] )
        )
    )
RETURN
    IF ( ISBLANK ( 'Table'[TICKET_NBR] ) || _Disc = 1, "No", "Yes" )

 

Output:

 

VahidDM_0-1635889807983.png

 

 

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

Appreciate your Kudos!!

 

View solution in original post

4 REPLIES 4
VahidDM
Super User
Super User

Hi @qsmith83 

 

Try this measure:

Column =
VAR _Disc =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[JOBID+Ticket] = EARLIER ( 'Table'[JOBID+Ticket] )
        )
    )
RETURN
    IF ( ISBLANK ( 'Table'[TICKET_NBR] ) || _Disc = 1, "No", "Yes" )

 

Output:

 

VahidDM_0-1635889807983.png

 

 

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

Appreciate your Kudos!!

 

qsmith83
Responsive Resident
Responsive Resident

@VahidDM, perfect that worked. Thank you.

amitchandak
Super User
Super User

@qsmith83 ,

a new column=

var _cnt = countx(filter(Table,[JobID+Ticket] =earlier([JobID+Ticket]) ),[JobID+Ticket])+0

return

if(isbalnk([TICKET_NBR]) && _cnt <=1 , "No", "Yes")



Learn Power BI - Full Course with Dec-2022, with new DAX functions like Window, Index, Offset !!
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Formatted Profit and Loss Statement with empty lines

Hi @amitchandak , thanks but it doesn't look right as its only showing all "Yes"

@VahidDM, any suggestions please?

Screenshot 2021-11-02 223354.jpg

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

Thank you 2022 Review

2022 Monthly Feature Releases

We had a great 2022 with a ton of feature releases to help you drive a data culture.

Top Solution Authors
Top Kudoed Authors