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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Twe-Maker
Frequent Visitor

# of recent TaskID for each person

I was just thinking, is it possible to look up 3 or 5 most recent task for each person. (With dax measure)

IDTaskIDNameDatetime
87Jame30/06/2022 11:00
78John30/06/2022 10:00
63Peter25/06/2022 15:00
54John25/06/2022 10:00
46Jame24/06/2022 14:00
31John24/06/2022 10:00
25Peter23/06/2022 12:00
14Peter23/06/2022 11:00

To use it on a matrix Rows Name and 5 most recent task



Something like this : https://community.powerbi.com/t5/DAX-Commands-and-Tips/FILTER-statement-to-return-most-recent-record...

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @Twe-Maker 

 

You can try the following methods.
Measure:

Rank =
RANKX (
    FILTER ( ALL ( 'Table' ), [Name] = SELECTEDVALUE ( 'Table'[Name] ) ),
    CALCULATE ( MAX ( 'Table'[Datetime] ) ),
    ,
    DESC
)

vzhangti_0-1666766124901.png

Suppose you want to display the last 2 Tasks.

Measure = IF([Rank]<=2,1,0)

vzhangti_1-1666766212354.png

This method can also be used in matrix.

Best Regards,

Community Support Team _Charlotte

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

View solution in original post

3 REPLIES 3
v-zhangti
Community Support
Community Support

Hi, @Twe-Maker 

 

You can try the following methods.
Measure:

Rank =
RANKX (
    FILTER ( ALL ( 'Table' ), [Name] = SELECTEDVALUE ( 'Table'[Name] ) ),
    CALCULATE ( MAX ( 'Table'[Datetime] ) ),
    ,
    DESC
)

vzhangti_0-1666766124901.png

Suppose you want to display the last 2 Tasks.

Measure = IF([Rank]<=2,1,0)

vzhangti_1-1666766212354.png

This method can also be used in matrix.

Best Regards,

Community Support Team _Charlotte

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

daXtreme
Solution Sage
Solution Sage

DAX measures do not ever return tables. They can only return scalars.

Thank you, I had a increment refresh on the table. I was trying to find a way to without creating a new column, but i guess back to power query. To create the RANKX in there.

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors