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
ttseng
Helper III
Helper III

Earliest Value based on filter/criteria

Hi, 

 

I have a dataset as follows:

 

IDDateSuccessScore
12311/19/202005
12311/20/202016
12311/21/202012
12211/19/202008
12211/20/202019
13311/19/202011
13311/20/202013
14411/19/202004

 

You'll notice that ID is a column with repeats with each row tracking the date and success and score. 

 

What I'm looking for is to be able to return the earliest known score for each unique ID where success is = 1. I would like to be able to populate the following (earliest_success_score). 

 

IDDateSuccessScoreEarliest_success_score
12311/19/202005null
12311/20/2020166
12311/21/202012null
12211/19/202008null
12211/20/2020199
13311/19/2020111
13311/20/202013null
14411/19/202004null

 

Thanks!

 

p.s. it's possible that there could be multiple submissions for a single day and the data has a time stamp in additiona to the date so the solution would look at earlist date and time (keeping the sample data simpler for ease of my understanding).

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@ttseng , Create a new column like

Column = var _1 = minx(FILTER(Data, [ID] =EARLIER([ID]) && Data[Success] = 1),Data[Date])
return 
if(_1 =[date] ,minx(FILTER(Data, [ID] =EARLIER([ID]) && Data[Success] = 1 && [Date] =_1),[Score]),BLANK())

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@ttseng , Create a new column like

Column = var _1 = minx(FILTER(Data, [ID] =EARLIER([ID]) && Data[Success] = 1),Data[Date])
return 
if(_1 =[date] ,minx(FILTER(Data, [ID] =EARLIER([ID]) && Data[Success] = 1 && [Date] =_1),[Score]),BLANK())

thanks @amitchandak ! your solution worked great. 

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.