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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Calculate Total CTC until Employee End Date only

Hello all,

 

I am calculating the CTC of X employees per month. But I'd like to calculate only until their employment end date.

 

sample Data:

Employee__r.NameCompensation_Start_Date__cCompensation End DateEmployment_End_Date__cTotal CTC
Hersheys Adams6/1/2021 8/17/20217,525
Gino Park7/5/2021 9/2/20218,813

 

I have this formula:

CTC =
var EmpEndDate = CALCULATE(LASTDATE(Compensation[Employee__r.Employment_End_Date__c]), ALL(Compensation))

return
IF(SELECTEDVALUE('Date'[Date]) > EmpEndDate, BLANK(),
CALCULATE([TOTAL CTC],
FILTER(ALLSELECTED('Date'),
'Date'[Date] <= MAX('Date'[Date]))))
 
However, the CTC is showing till end of the year (past their end date)
DateEmployee__r.NameCompensation_Start_Date__cCompensation End DateEmployment_End_Date__cCTC
Jun 2021Hersheys Adams6/1/2021 8/30/20217525
Jul 2021Hersheys Adams6/1/2021 8/30/20217525
Aug 2021Hersheys Adams6/1/2021 8/30/20217525
Sep 2021Hersheys Adams6/1/2021 8/30/20217525
Oct 2021Hersheys Adams6/1/2021 8/30/20217525
Nov 2021Hersheys Adams6/1/2021 8/30/20217525
Dec 2021Hersheys Adams6/1/2021 8/30/20217525
Jul 2021Gino Park7/5/2021 9/30/20218813
Aug 2021Gino Park7/5/2021 9/30/20218813
Sep 2021Gino Park7/5/2021 9/30/20218813
Oct 2021Gino Park7/5/2021 9/30/20218813
Nov 2021Gino Park7/5/2021 9/30/20218813
Dec 2021Gino Park7/5/2021 9/30/20218813
 
katvaldez_1-1631036986751.png

I'm expecting something like 

DateEmployee__r.NameCompensation_Start_Date__cCompensation End DateEmployment_End_Date__cCTC
Jun 2021Hersheys Adams6/1/2021 8/30/20217525
Jul 2021Hersheys Adams6/1/2021 8/30/20217525
Aug 2021Hersheys Adams6/1/2021 8/30/20217525
Jul 2021Gino Park7/5/2021 9/30/20218813
Aug 2021Gino Park7/5/2021 9/30/20218813
Sep 2021Gino Park7/5/2021 9/30/20218813
 
katvaldez_2-1631037236862.png

Any help is much appreciated!

 
1 ACCEPTED SOLUTION
wdx223_Daniel
Super User
Super User

IF(MIN('Date'[Date]) > EmpEndDate

View solution in original post

2 REPLIES 2
wdx223_Daniel
Super User
Super User

IF(MIN('Date'[Date]) > EmpEndDate

Anonymous
Not applicable

@wdx223_Daniel Thank you so much!! 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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