Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi there,
I have a table which looks like as follow:
This table is connected with a date table which has got RY Month number. April has RY month number =1 and Mar has RY month = 12. I want to calculate the cumulative sum of the value of those months who has not gone yet. It should look like as follow:
So I am creating measure something like as follow:
However, it does not produce the desired result. Could anyone help me where am I making the mistake?
Link of file: https://1drv.ms/u/s!AucycxZHFe9TjUOV3GfsP_bL3FcC?e=LwTupY
Solved! Go to Solution.
@Dunner2020 , you might want to try this measure to achieve desired values,
Cumulative measure =
VAR _CYMonth = MONTH ( TODAY () )
VAR _RYMonth = IF ( _CYMonth > 3, _CYMonth - 3, _CYMonth + 9 )
RETURN
SUMX (
FILTER (
ALL ( '5y average' ),
'5y average'[Month Number] <= MAX ( '5y average'[Month Number] )
&& '5y average'[Month Number] >= _RYMonth
),
CALCULATE ( SUM ( '5y average'[Value] ) )
)
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
Hi,
You may download my PBI file from here.
Hope this helps.
@Ashish_Mathur , I have attached dummy file in the post. Unfortunately, your calculation did not work in my file.
Hi,
Your solution is not even remotely close to what i have suggested. In your visual, Year and Month name have to be dragged from the Calendar Table. Furthermore, your cumulative measure is nowhere close to mine. Please study the file that i have shared with you, very carefully.
Hi, @Dunner2020 , as to your measure, an error lies in the misuse of variable in this part, I think.
Var remain_month = SUM('Table'[Value])
Var remain_month_cum = SUMX(FILTER(ALL(Dates),Dates[RY Month Number]>=_RYMonth),remain_month)
In fact, variables in DAX are NOT THAT VARIABLE as expected!
In DAX, variables are calculated within the scope in which they are written, and then the result of them is stored and used in the rest of the expression.
You might want to refer to an article on this subject for more details.
Without a complete data model, it's hard to debug to the fullest extent. If you attach a dummy file with enough mockup data, it's way much easier to troubleshoot.
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
@Dunner2020 , you might want to try this measure to achieve desired values,
Cumulative measure =
VAR _CYMonth = MONTH ( TODAY () )
VAR _RYMonth = IF ( _CYMonth > 3, _CYMonth - 3, _CYMonth + 9 )
RETURN
SUMX (
FILTER (
ALL ( '5y average' ),
'5y average'[Month Number] <= MAX ( '5y average'[Month Number] )
&& '5y average'[Month Number] >= _RYMonth
),
CALCULATE ( SUM ( '5y average'[Value] ) )
)
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.