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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
briansull
Regular Visitor

Find Latest duplicate

Hi All,

 

I have a Scorm learning dataset that has many duplicate records. This happens if a user starts a course and does not finish but comes back and finishes at a later date. The system creates a record for every attempt 😞 

 

I need to filter and show the latest attempt with result 

 

i.e.

Course ID |   Complete | Employee ID | Completed Date

1               |         0         |      111          |  09-12-22

1               |          1        |       111         |  12-12-22

1 ACCEPTED SOLUTION
ERD
Community Champion
Community Champion

Hi, @briansull , one of the options for your measure:

status =
VAR course = MAX ( Table1[Course] )
VAR employee = MAX ( Table1[Employee] )
VAR dt =
    CALCULATE (
        MAX ( Table1[Date] ),
        Table1[Employee] = employee,
        Table1[Course] = course,
        ALL ( Table1[Date] )
    )
VAR res =
    IF (
        MAX ( Table1[Date] ) = dt,
        CALCULATE (
            MAX ( Table1[Completed] ),
            Table1[Employee] = employee,
            Table1[Course] = course
        )
    )
RETURN
    res

 

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

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

View solution in original post

10 REPLIES 10
ERD
Community Champion
Community Champion

Hi, @briansull , one of the options for your measure:

status =
VAR course = MAX ( Table1[Course] )
VAR employee = MAX ( Table1[Employee] )
VAR dt =
    CALCULATE (
        MAX ( Table1[Date] ),
        Table1[Employee] = employee,
        Table1[Course] = course,
        ALL ( Table1[Date] )
    )
VAR res =
    IF (
        MAX ( Table1[Date] ) = dt,
        CALCULATE (
            MAX ( Table1[Completed] ),
            Table1[Employee] = employee,
            Table1[Course] = course
        )
    )
RETURN
    res

 

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

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

I think that's it thank so much. I need to verify still but looks good

some_bih
Super User
Super User

Hi @briansull please provide more clear requirements: 

you want to see

per employee ID

the latest date

for column Completed Date only 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






That is correct some_bih 

Hi @briansull please find following measure and outuput

MaxDate Compplete Per Employee =
VAR __max_date_complete =
MAX ( Sheet1[Completed Date] )
VAR __employee_ID =
SELECTEDVALUE ( Sheet1[Employee ID] )
VAR __course_ID =
SELECTEDVALUE ( Sheet1[Course ID] ) -- if more course is choosed
VAR __Result =
CALCULATE (
    MAX ( Sheet1[Completed Date] ),
    Sheet1[Completed Date] = __max_date_complete
        && Sheet1[Employee ID] = __employee_ID
        && Sheet1[Course ID] = __course_ID,
    Sheet1[Complete] = "1" -- 2 = completed, 0 not completed
)
RETURN __Result
 

Did I answer correctly? Kudos appreciate / accept solution.

some_bih_0-1694375427895.png

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Thank you Some_bih,

 

The measure is nearly correct but i need to list all courses with the one measure if completed or not completed. The proposed solution measure only brings back completed if set to 1

 

Hi @briansull check v2 below😊

Did I answer your question? Kudos appreciated / accept solution!

MaxDate Compplete Per Employee v2 =
VAR __max_date_complete =
MAX ( Sheet1[Completed Date] )
VAR __employee_ID =
SELECTEDVALUE ( Sheet1[Employee ID] )
VAR __course_ID =
SELECTEDVALUE ( Sheet1[Course ID] ) -- if more course is choosed
VAR __Result =
CALCULATE (
    MAX ( Sheet1[Completed Date] ),
    Sheet1[Completed Date] = __max_date_complete
        && Sheet1[Employee ID] = __employee_ID
        && Sheet1[Course ID] = __course_ID
   
)
RETURN __Result




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Thank you

 

I am now getting all courses but still see duplicates

 

i.e. course 1 is complete, course 1 is not complete

Hi @briansull provide expected result for input





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Thank you. I need to show who hasn't completed courses either

 

i.e.

 

Table

Course 1 | Employee 2 | Completed 1 | Date 20-12-2022

Course 1 | Employee 2 | Completed 0  | Date 19-12-2022

Course 2 | Employee 2 | Completed 0 | Date 21-12-2002

 

Expected Results

Course 1 | Employee 2 | Completed 1 | Date 20-12-2022

Course 2 | Employee 2 | Completed 0 | Date 21-12-2002

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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