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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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