Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I need a dynamic measure that can make a running total summing the amount of days between two dates per employee. I want the measure to be able to run in 12 months 'windows'. Please regard I am not able to use window functions since i use analysis services which doesn't include window functions.
This is the data:
Among other attempts I have tried:
Solved! Go to Solution.
@Anonymous
Hi, thx for the advice, but I couldn't get your idea to work.
I've worked on it some more and got it to work with this:
@Anonymous
Hi, thx for the advice, but I couldn't get your idea to work.
I've worked on it some more and got it to work with this:
Hi @LasseLJørgensen ,
According to your description, here are my steps you can follow as a solution.
(1) My test data is the same as yours.
(2) We can create measures.
Measure = DATEDIFF(MAX('Table'[Date incurred]),MAX('Table'[Date paid]),DAY)
Measure 2 =
var _a=SUMX(
SUMMARIZE(
FILTER(ALL( 'Table'),'Table'[Date paid]<=MAX('Table'[Date paid])),
'Table'[Employee number],
'Table'[Date incurred],'Table'[Date paid],
"total",[Measure]
),
[total]
)
var _b=IF([Measure]=0,0,_a)
return CALCULATE(_b,DATESINPERIOD('Table'[Date paid], MAX('Table'[Date paid]), -1, YEAR))
(3) Then the result is as follows.
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Dangar332
That gives the same result. What I'm expectning is:
26-01-2014 = 5
14-02-2014 = 15
16-04-2014 = 33
and so on.
hi, @LasseLJørgensen
try below
Running total =
var a = edate(min('Data'[Date paid]),-12)
var b = min('Data'[employee number])
return
var c =sumx(
filter(
'Data',
'Data'[employee number] = b &&
'Data'[Date paid]<= min('Data'[Date paid]) && 'Data'[Date paid]>=a
),
DATEDIFF(MIN('Data'[Date incurred]), MIN('Data'[Date paid]), DAY )
)
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
19 | |
7 | |
6 | |
5 | |
5 |
User | Count |
---|---|
25 | |
10 | |
10 | |
9 | |
6 |