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

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

Reply
Anonymous
Not applicable

How to return distinct text values based on earliest date and Id columns?

Hi Power Bi Community,

 

I am so glad to find such a big community that are willing to help others!

 

Could you please help me out! 

 

To simplify things, I have 'Fruit' visual table with the following: 

FearlessHunter_0-1647345969502.png

 

 

IDFruit SelectedDate SelectedTime Selected
1Banana15/3/202210:41pm
1Banana15/3/202211:41pm
1Apple15/3/202211:41pm
2Banana15/3/20229:10pm
2Apple15/3/202210:10pm

 

 

I want the table to be able to return me the below instead:

 

IDFruit SelectedDate SelectedTime Selected
1Banana15/3/202210:41pm
1Apple15/3/202211:41pm
2Banana15/3/20229:10pm
2Apple15/3/202210:10pm

 

See how it filterd out the duplicate banana that was selected on later time for the same ID.

 

I want a DAX formula/measure that able to perform this for me.

 

Please note, the measure must be able to work in a DirectQuery mode.

 

Thank you!!!!

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

First Time = SELECTCOLUMNS( TOPN( 1,'Table', 'Table'[Time Selected],ASC), "@time", 'Table'[Time Selected] )

create this as a measure and put it in a table visual with the ID, fruit and date columns

View solution in original post

4 REPLIES 4
johnt75
Super User
Super User

First Time = SELECTCOLUMNS( TOPN( 1,'Table', 'Table'[Time Selected],ASC), "@time", 'Table'[Time Selected] )

create this as a measure and put it in a table visual with the ID, fruit and date columns

Anonymous
Not applicable

Hi Johnt75,

 

Thank you for your support.

 

I have created the above measure but it return date and time in one column instead, it did not eliminate the duplicate text values. 😥

Make sure that the selected date and selected time columns are separate columns and that they have the correct types - the selected date column should be a date type, not a datetime, and the selected time column should be a time type.

You may also need to change the display format of the measure to just show the time

Anonymous
Not applicable

You are a legend! Thank you so much! You have saved me. 🤗

Helpful resources

Announcements
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.