Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Hello everyone,
I am new to the Power BI community. Thank you in advance for your help.
I have a problem with a cummulative calculation from a measure. This calculation works perfectly for the years, but it does not work for months. Let me explain:
I have two tables of human resources (entries and exits of employees):
- Entries
- Departures
I need to know the evolution of the workforce of the company, by year but also by month (to know the monthly evoulution in each year)
I mean, I need to create a chart with the total cumulate number of employees (running total)
To do this, I created several things:
- A date table
- Measures:
SumAnual Entries (sum of entries per year)
SumAnalDepartures (sum of departures per year)
DiffEntriesDepartures_YEAR (difference between the two preceding measures, that is the workforce of the company at the end of each year)
RunningTotalWorkforce_YEAR (cumulative effect after year)
For the year, it works perfectly.
The same thing for months, it does not work at all.
You think the problem comes from where? I tried many things but nothing worked.
I leave you my power BI file.
https://drive.google.com/open?id=1iuSBrca3SS5JhMAYQGAowvKDamPjtl-d
I thank you so much if anyone can help me.
Best regards,
Alberto
Solved! Go to Solution.
Hi @AlbLS
I've simplified this for you, hope its what you need.
# Entries = COUNTROWS( Entries )
# Departures = COUNTROWS( Departures )
# Difference = [# Entries] - [# Departures]
# Difference Running Total =
IF(
NOT ISEMPTY( Departures ) || NOT ISEMPTY( Entries ),
CALCULATE(
[# Difference],
FILTER(
ALL( 'Date' ),
'Date'[Date] <= MAX( 'Date'[Date] )
)
)
)
Hi,
You may download my PBI file from here.
Hope this helps.
Hi Ashish,
Thank you very much for your answer and for your power bi file.
Unfortunately it does not solve my problem either, I already had the same result as you, but when the year changes, running totoal starts from scratch, and this is a mistake.
What I need is a graph like this:
when I'm going to filter for the year 2017, i will get this:
and filter for the year 2018, this:
I hope we can find the solution, for the moment I can not do it.
Thank you very much again.
Alberto
Hi,
Change the New Joinees YTD measure to:
Net joinees YTD = CALCULATE([Net joinees],DATESBETWEEN('Date'[Date],MINX(ALL('Date'),'Date'[Date]),MAX('Date'[Date])))
Hope this helps.
Thank you Ashish.
Your solution also works. It is different from that of Mariuzs, but it also works.
This could help other users!
Thank you so much!
Alberto
You are welcome. If my reply helped, please mark it as Answer.
Hi @AlbLS
I've simplified this for you, hope its what you need.
# Entries = COUNTROWS( Entries )
# Departures = COUNTROWS( Departures )
# Difference = [# Entries] - [# Departures]
# Difference Running Total =
IF(
NOT ISEMPTY( Departures ) || NOT ISEMPTY( Entries ),
CALCULATE(
[# Difference],
FILTER(
ALL( 'Date' ),
'Date'[Date] <= MAX( 'Date'[Date] )
)
)
)
Hi Mariusz,
Thank you very much for your answer.
Unfortunately this does not solve my problem, as you can see in the following picture:
What I need is a graph like this:
when I'm going to filter for the year 2017, i will get this:
and filter for the year 2018, this:
I hope we can find the solution, for the moment I can not do it.
Thank you very much again.
Alberto
Hi @AlbLS
Please see the file in the link.
https://drive.google.com/file/d/1ZDGVjlu4nNnweYCk6H9NUkWgX5Iscy2A/view?usp=sharing
Thank you very much Mariuzs.
Your solution works perfectly, I really thank you. In addition, you have simplified the task because now I do not need different formulas for years and months, with your solution it works for both cases. It's perfect!
There is only one thing that I changed, I deleted from your formula the following part:
IF (
NOT ISEMPTY (Departures) || NOT ISEMPTY (Entries)
)
Because it caused empty columns when there were no entries and no departures for a year or for a month. As we see here:
But i delete the IF statement, it works very well.
Thanks again.
Alberto
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 57 | |
| 55 | |
| 42 | |
| 16 | |
| 16 |
| User | Count |
|---|---|
| 113 | |
| 105 | |
| 39 | |
| 35 | |
| 26 |