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
pperumal
Frequent Visitor

Calculate value of previous month using the next month data

Hello,

I have a requirement, where i need to calculate the headcount for the previous months using the current month total headcount, current month new hire and current month termination

Here is the calculation,

headcount(Sep) = Headcount(OCT) - new hire(OCT) + termination(OCT)

 

My existing table looks like

pperumal_1-1670356192829.png

 

I have done a cumulative sum on Active headcount to get the latest month total headcount of that team(=496), 

 

Here is the screen shot of what i need to achieve

pperumal_2-1670356210362.png

Headcount(sep2022) = 496-2+4 => 498(Result)

 

Can someone help me on this!

 

Thank you

1 REPLY 1
ryan_mayu
Super User
Super User

@pperumal 

pls check if this is what you want

Column = 
VAR _s=min('Table'[date])
VAR _s2=maxx(FILTER('Table','Table'[date]=_s),'Table'[active hc])
VAR _n=sumx(FILTER('Table','Table'[date]<=EARLIER('Table'[date])),'Table'[new hire])
VAR _t=sumx(FILTER('Table','Table'[date]<=EARLIER('Table'[date])),'Table'[termination])
return _s2+_n-_t

1.PNG

pls see the attachment below

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.