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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
jbakerstull
Regular Visitor

Latest Exit

I'm a very new to power BI.  My objective is create a DAX that returns numberic values of 0, 1 in column "Exit".

 

Exit is defined by using the client latest entry and if an exit occurs prior to "Period_End_Date" then it's considered an exit (value of 1) if not then return an value of 0. 

 

I learned how to create an DAX formula that identifies client's latest (max) exit date but I'm stuggling how to complete it.  

 

LatestExitDate = CALCULATE (
   DateValue(
   CALCULATE(
    MAX ( Client[Exit_Date] ),
    ALLEXCEPT ( Client, Client[Clients Personal ID] )
    )))

 

 

Clients Personal IDStart_DateExit_DateEnrollments Reporting Period Start DatePeriod_End_DateExit
6446Wednesday, May 24, 2023 Sunday, January 1, 2023Thursday, June 29, 20230
6446Friday, May 5, 2023Tuesday, May 9, 2023Sunday, January 1, 2023Thursday, June 29, 20230
6448Tuesday, January 17, 2023Monday, January 23, 2023Sunday, January 1, 2023Thursday, June 29, 20231
6453Friday, May 26, 2023Wednesday, June 28, 2023Sunday, January 1, 2023Thursday, June 29, 20231
6453Thursday, May 4, 2023Wednesday, May 24, 2023Sunday, January 1, 2023Thursday, June 29, 20230

 

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @jbakerstull ,

 

Please try:

Exit = IF(SELECTEDVALUE(Client[Exit_Date])=[LatestExitDate]&&[LatestExitDate]<SELECTEDVALUE(Client[Period_End_Date]),1,0)

Output:

vjianbolimsft_0-1688088580960.png

If you need to consider about the blank Exit_Date, please try:

Exit' = 
var _a = CALCULATE(MAX('Client'[Start_Date]),ALLEXCEPT(Client,Client[Clients Personal ID]))
var _b = CALCULATE(MAX('Client'[Exit_Date]),FILTER(ALLEXCEPT(Client,Client[Clients Personal ID]),[Start_Date]=_a))
return IF(_b<>BLANK()&&SELECTEDVALUE(Client[Exit_Date])=_b&&_b<SELECTEDVALUE(Client[Period_End_Date]),1,0)

Final output:

vjianbolimsft_1-1688088824341.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-jianboli-msft
Community Support
Community Support

Hi @jbakerstull ,

 

Please try:

Exit = IF(SELECTEDVALUE(Client[Exit_Date])=[LatestExitDate]&&[LatestExitDate]<SELECTEDVALUE(Client[Period_End_Date]),1,0)

Output:

vjianbolimsft_0-1688088580960.png

If you need to consider about the blank Exit_Date, please try:

Exit' = 
var _a = CALCULATE(MAX('Client'[Start_Date]),ALLEXCEPT(Client,Client[Clients Personal ID]))
var _b = CALCULATE(MAX('Client'[Exit_Date]),FILTER(ALLEXCEPT(Client,Client[Clients Personal ID]),[Start_Date]=_a))
return IF(_b<>BLANK()&&SELECTEDVALUE(Client[Exit_Date])=_b&&_b<SELECTEDVALUE(Client[Period_End_Date]),1,0)

Final output:

vjianbolimsft_1-1688088824341.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.