Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
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
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.