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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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