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

The 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.

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

@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
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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