Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
im not able to achieve rolling sum values for below dax
test2 =
var endmonth = SELECTEDVALUE(W_MCAL_PERIOD_D[MCAL_JULIAN_PERIOD_NUM])
var startmonth = endmonth-11
RETURN
CALCULATE(SUM(HR_FACT[_Terminated Voluntary Employee OHR]), HR_FACT[Gender] = "Female"&&HR_FACT[TERMINATION_REASON] <> "Retirement", 'W_MCAL_PERIOD_D'[MCAL_JULIAN_PERIOD_NUM] >= startmonth,ALL(W_MCAL_PERIOD_D ) )
any help.
need to get rolling sum values for above screenshot
Here is an improved DAX formula to calculate the rolling sum:
test2 =
VAR CurrentMonth = SELECTEDVALUE(W_MCAL_PERIOD_D[MCAL_JULIAN_PERIOD_NUM])
VAR StartMonth = CurrentMonth - 11
RETURN
CALCULATE(
SUM(HR_FACT[_Terminated Voluntary Employee OHR]),
HR_FACT[Gender] = "Female",
HR_FACT[TERMINATION_REASON] <> "Retirement",
FILTER(
ALL(W_MCAL_PERIOD_D),
W_MCAL_PERIOD_D[MCAL_JULIAN_PERIOD_NUM] >= StartMonth &&
W_MCAL_PERIOD_D[MCAL_JULIAN_PERIOD_NUM] <= CurrentMonth
)
)
test2 =
VAR EndMonth = SELECTEDVALUE(W_MCAL_PERIOD_D[MCAL_JULIAN_PERIOD_NUM])
VAR StartMonth = EndMonth - 11
RETURN
CALCULATE(
SUM(HR_FACT[_Terminated Voluntary Employee OHR]),
HR_FACT[Gender] = "Female",
HR_FACT[TERMINATION_REASON] <> "Retirement",
W_MCAL_PERIOD_D[MCAL_JULIAN_PERIOD_NUM] >= StartMonth &&
W_MCAL_PERIOD_D[MCAL_JULIAN_PERIOD_NUM] <= EndMonth,
ALL(W_MCAL_PERIOD_D)
)
💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn
User | Count |
---|---|
134 | |
72 | |
71 | |
55 | |
53 |
User | Count |
---|---|
201 | |
95 | |
63 | |
62 | |
51 |