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
jhubert41
New Member

Show most 5 recent records based on date and team name

Hello, I am looking to get the following output on the right. On the left is the original dataset. Bascially I am looking to filter my data to show the most 5 recent dates grouped by team name. Any help is appreciated! 

powerbi.PNG

 

1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @jhubert41 ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want.

1. Create a measure as below:

Flag = 
VAR _selaway =
    SELECTEDVALUE ( 'Table'[Away] )
VAR _rank =
    RANKX (
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Away] = _selaway ),
        CALCULATE ( MAX ( 'Table'[Date] ) ),
        ,
        DESC,
        DENSE
    )
RETURN
    IF ( _rank <= 5, 1, 0 )

2. Create a table visual and apply the visual-level filter with the condition(Flag is 1)

yingyinr_0-1669256731456.png

Best Regards

Community Support Team _ Rena
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

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Create a slicer of Away and select ANA.  to your Table visual, drag Home and write these measures

Date value = sum(Data[Date])

Top 5 = calculate([Date value]),topn(5,all(Data[Home]),[Date value]),values(Data[Home]))

Drag the Top 5 measure to the visual.  

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-yiruan-msft
Community Support
Community Support

Hi @jhubert41 ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want.

1. Create a measure as below:

Flag = 
VAR _selaway =
    SELECTEDVALUE ( 'Table'[Away] )
VAR _rank =
    RANKX (
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Away] = _selaway ),
        CALCULATE ( MAX ( 'Table'[Date] ) ),
        ,
        DESC,
        DENSE
    )
RETURN
    IF ( _rank <= 5, 1, 0 )

2. Create a table visual and apply the visual-level filter with the condition(Flag is 1)

yingyinr_0-1669256731456.png

Best Regards

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

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.