Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

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

  • Anonymous , 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())

2 Replies

  • Anonymous , 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())
    • Anonymous's avatar
      Anonymous
      Not applicable

      thanks amitchandak ! your solution worked great.