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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Measure that will identify the last task per ID

Hi Team,

 

Newbie here,

 

I am having an issue on using below measure when it comes to identifying the last task inserted by the user.

 

I am using below measure:

Measure =
VAR __id = MAX( 'Table'[EmployeeID] )
VAR __date = CALCULATE ( MAX( 'Table'[Date] ), ALLSELECTED ( 'Table' ), 'Table'[EmployeeID] = __id )
RETURN CALCULATE ( sum ( 'Table'[EmployeeID] ), VALUES ( 'Table'[EmployeeID] ), 'Table'[EmployeeID] = __id, 'Table'[Date] = __date )

 

Result:

Capture67.PNG

This works fine, however, when the user inserted the same task, my measure will give a 2 outputs.

 

Instead of that, I want a result to be like this:

Capture89.PNG

 

Another Note:

There are multiple users that will insert a task so the output must be 1 for each user.

 

Thank you so much for answering! Greatly appreciate it !

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

Hi @Anonymous 

I think you can try smth like

Measure =
VAR __id = MAX( 'Table'[EmployeeID] )
VAR __date = CALCULATE ( MAX( 'Table'[Date] ), ALLSELECTED ( 'Table' ), 'Table'[EmployeeID] = __id )
RETURN 
IF(SELECTEDVALUE('Table'[EmployeeID]) = __id && SELECTEDVALUE('Table'[Date]) = __date, __id, BLANK()  )

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

This seem fine.

Can you share sample data and sample output.

Anonymous
Not applicable

Hi @amitchandak ,

 

I've provided a screenshot.

 

on the first screenshot there are 2 output wherein it should be one because its the same ID its just that the task are the same. The output must only be 1 and it supposed to be the latest row based on date/time as shown on the 2nd screenshot.

az38
Community Champion
Community Champion

Hi @Anonymous 

I think you can try smth like

Measure =
VAR __id = MAX( 'Table'[EmployeeID] )
VAR __date = CALCULATE ( MAX( 'Table'[Date] ), ALLSELECTED ( 'Table' ), 'Table'[EmployeeID] = __id )
RETURN 
IF(SELECTEDVALUE('Table'[EmployeeID]) = __id && SELECTEDVALUE('Table'[Date]) = __date, __id, BLANK()  )

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

Hi @az38 ,

 

This works great! Thank you!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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