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
Craines
Helper II
Helper II

Select specific date based on filter criteria

Hi, I have two tables containing student application data as follows:

 

StudentTable

StudentIdStatusChangeDateDeferral?AppDate
Student1A101/10/2020TRUE01/10/2020
Student1Os205/10/2020TRUE01/10/2020
Student1Oz506/10/2020TRUE01/10/2020
Student2Aa507/10/2020FALSE 
Student2R3311/10/2020FALSE 
Student3A7h02/10/2020TRUE02/10/2020
Student3O104/10/2020TRUE02/10/2020
Student3AC805/10/2020TRUE02/10/2020
Student4A106/10/2020TRUE06/10/2020
Student4O309/10/2020TRUE06/10/2020
Student4O310/10/2020TRUE06/10/2020

 

StatusTable (is much larger - only showing relevant codes) - linked to StudentTable on Status

StatusApplicationOfferAcceptance
A1100
Aa5100
A7h100
Os2110
Oz5110
O1110
O3110
AC8111
R33100

 

I have calculated the AppDate column using the following:

 

DeferAppDate = IF( 'StudentTable'[Deferral?] = True, MINX( FILTER('StudentTable', 'StudentTable'[StudentId] = EARLIER( 'StudentTable'[StudentId])), 'StudentTable'[ChangeDate]))
 
I would now like a column which picks up the date at which the first offer is made to look as follows:
StudentIdStatusChangeDateDeferral?AppDateOfferDate
Student1A101/10/2020TRUE01/10/202005/10/2020
Student1Os205/10/2020TRUE01/10/202005/10/2020
Student1Oz506/10/2020TRUE01/10/202005/10/2020
Student2Aa507/10/2020FALSE  
Student2R3311/10/2020FALSE  
Student3A7h02/10/2020TRUE02/10/202004/10/2020
Student3O104/10/2020TRUE02/10/202004/10/2020
Student3AC805/10/2020TRUE02/10/202004/10/2020
Student4A106/10/2020TRUE06/10/202009/10/2020
Student4O309/10/2020TRUE06/10/202009/10/2020
Student4O310/10/2020TRUE06/10/202009/10/2020

 

I am struggling as this is neither the MAX or MIN date, so I haven't been able to use the same approach as for the AppDate (which will always be the first date), and wonder if the approach needs to involve "Offer = 1" from the StatusTable?

 

Thanks in advance!

1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @Craines ,

 

Please try this measure:

offerDate = 
CALCULATE(
    MIN(StudentTable[ChangeDate]),
    CONTAINSSTRING(StudentTable[Status], "O"),
    ALLEXCEPT(StudentTable, StudentTable[StudentId])
)

 

This gives me the following ouput:

BA_Pete_0-1610557225986.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

2 REPLIES 2
BA_Pete
Super User
Super User

Hi @Craines ,

 

Please try this measure:

offerDate = 
CALCULATE(
    MIN(StudentTable[ChangeDate]),
    CONTAINSSTRING(StudentTable[Status], "O"),
    ALLEXCEPT(StudentTable, StudentTable[StudentId])
)

 

This gives me the following ouput:

BA_Pete_0-1610557225986.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




This worked perfectly, thanks @BA_Pete !

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.