Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
raju8004
Frequent Visitor

dax help

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.

raju8004_0-1732600536071.png

need to get rolling sum values for above screenshot

4 REPLIES 4
rohit1991
Super User
Super User

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
)
)


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

@rohit1991 
 still im not able to get running total values

raju8004_0-1732602570887.png

 

Kedar_Pande
Super User
Super User

@raju8004 

 

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

@Kedar_Pande still im not able to get running total values

raju8004_0-1732602570887.png

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors