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.
https://drive.google.com/file/d/1pWvFXrZcE9s8QAq9dBjkaBSEUlJMJCRD/view?usp=sharing
I am trying to get the cumulative of EW , and it is not working.
I am using the below formula:
BreakContextTransitionTable =
VAR __YMTable = SUMMARIZE(ALL('Date'), 'Date'[MonthnYear])
VAR __YMTableEW = ADDCOLUMNS(__YMTable, "@EW", [EW])
RETURN
__YMTableEW
EW =
VAR __filter = FILTER(BreakContextTransitionTable, BreakContextTransitionTable[MonthnYear] <= MAX('Date'[MonthnYear]))
RETURN
SUMX(__filter, BreakContextTransitionTable[@EW])
But can anyone let me know, how can this be done in a single measure , without creating a new calculated table.
What is your expected outcome? Do you want to add up all the EW values for the current and prior months?
Expected result:
Hi Anu
I have the same problem... Has anyone helped?
Please try this measure expression. It is a little slow but that may be because of your existing measures that it references.
NewMeasure =
VAR vMaxDate =
MAX ( 'Date'[Date] )
RETURN
CALCULATE (
SUMX (
VALUES ( 'Date'[MonthInCalendar] ),
[EW]
),
FILTER (
ALL ( 'Date'[Date] ),
'Date'[Date] <= vMaxDate
)
)
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Thanks @mahoneypat , but this measure seems to be extremely slow even with small data.
And my actual model is very huge 😞
Any ways to improve performance?
Here is a new measure that avoid referencing your other measures. I ran out of time before work, but it is very close and much faster. Hopefully, you can tweak it from here. If not, I can finish it this evening.
NewMeasure3 =
VAR vMaxDate =
MAX ( 'Date'[Date] )
VAR vMonths =
CALCULATETABLE (
DISTINCT ( 'Date'[MonthInCalendar] ),
FILTER (
ALL ( 'Date'[Date] ),
'Date'[Date] <= vMaxDate
)
)
VAR vSummary =
ADDCOLUMNS (
vMonths,
"cResult",
VAR vODCumulative =
CALCULATE (
SUM ( Cashflow[Amount] ),
Cashflow[Type] = "FC",
FILTER (
ALL ( 'Date'[Date] ),
'Date'[Date] <= vMaxDate
)
)
VAR vCashCost =
CALCULATE (
SUM ( CashCost[Cash Cost] )
)
VAR vResult = vODCumulative - vCashCost
RETURN
vResult
)
RETURN
SUMX (
FILTER (
vSummary,
[cResult] > 0
),
[cResult]
)
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
@Antmkjr Finally got back to this one. Here is the final measure that works and is much faster.
NewMeasure3 =
VAR vMaxDate =
MAX ( 'Date'[Date] )
VAR vMonths =
CALCULATETABLE (
SUMMARIZE (
'Date',
'Date'[MonthInCalendar],
"cThisMaxDate", MAX ( 'Date'[Date] )
),
FILTER (
ALL ( 'Date'[Date] ),
'Date'[Date] <= vMaxDate
)
)
VAR vSummary =
ADDCOLUMNS (
vMonths,
"cResult",
VAR vODCumulative =
CALCULATE (
SUM ( Cashflow[Amount] ),
Cashflow[Type] = "FC",
FILTER (
ALL ( 'Date'[Date] ),
'Date'[Date] <= [cThisMaxDate]
)
)
VAR vCashCost =
CALCULATE (
SUM ( CashCost[Cash Cost] )
)
VAR vResult = vODCumulative - vCashCost
RETURN
vResult
)
RETURN
SUMX (
FILTER (
vSummary,
[cResult] > 0
),
[cResult]
)
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Brilliant you are!
@Antmkjr , Can you add some sample data & expected outcome. I am unable to download files. We can fix this for you.
Proud to be a Super User!
Awesome Keyboard Shortcusts in Power BI, thumbs up if you like the article
My Community Blog Articles (check them out!)
My Blog - Power M code to automatically detect column types -
How to create test data using DAX!
https://drive.google.com/file/d/1pWvFXrZcE9s8QAq9dBjkaBSEUlJMJCRD/view?usp=sharing
Could you please check if you are able to download this?
Expected Outcome:
Check out the November 2025 Fabric update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!