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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Knif
Frequent Visitor

Issue extracting details when filtering by latest date

Hi Guys,

 

This is my first post, and I'd like to start by thanking you for this forum where I usually find a lot of precious information.

I am fairly new to using PowerBI, and I'm facing a problem that I can't solve, even though I feel I have solved more complicated ones... I feel a bit ridiculuous 👶

 

I have the following table:

Country Company   User   Date of Registration
Italy       Coca-ColaA12/01/2022
Italy       Pepsi         B20/10/2022
Italy       Coca-ColaC13/07/2021
France   Fanta         D15/06/2022
Italy       Coca-ColaE11/01/2022
France   Kro             F10/02/2021 
    

 

And I would like to get a resulting table displaying the Lastest Registration by Country

Country Company   User   Date of Registration
Italy       Pepsi         B20/10/2022
France   Fanta         D15/06/2022
    

 

I can easily get the latest Registration Date by Country, but when I insert the user details, then it logically multiples the lines...

 

I tried using LASTDATE, MAX, etc. but I don't find the solution.

Would you have any hint to share with me ?

 

Cheers,

Nick

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

If you want the results to be dynamic and respond to filters and slicers you would need to create a separate measure for each column you want to display. The general format could be

Latest Country =
SELECTCOLUMNS (
    SAMPLE ( 1, 'Table', 'Table'[Registration Date], DESC ),
    'Table'[Country ID]
)

and just swap the final argument to SELECTCOLUMNS for the appropriate column you wish to return.

I use SAMPLE instead of TOPN because SAMPLE is guaranteed to return only 1 row, even in the event of ties, whereas TOPN would return all the rows in the event of a tie.

View solution in original post

2 REPLIES 2
Knif
Frequent Visitor

Thank you very much. It works great. ❤️
I would have never figured it out by myself.

 

 

johnt75
Super User
Super User

If you want the results to be dynamic and respond to filters and slicers you would need to create a separate measure for each column you want to display. The general format could be

Latest Country =
SELECTCOLUMNS (
    SAMPLE ( 1, 'Table', 'Table'[Registration Date], DESC ),
    'Table'[Country ID]
)

and just swap the final argument to SELECTCOLUMNS for the appropriate column you wish to return.

I use SAMPLE instead of TOPN because SAMPLE is guaranteed to return only 1 row, even in the event of ties, whereas TOPN would return all the rows in the event of a tie.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.