cancel
Showing results for
Did you mean:

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Helper I

## Cumulative of (Value^2)

Hello,

I have a question to calculate running sum of a formula.

I have a table

I want to calculate the running sum of (Value^2).

I expect to have for each row:

(7^2) = 49

(7^2) + (1^2) = 50

(7^2) + (1^2) + (2^2) = 54

I tried to do it in DAX

``````Measure 5 =
CALCULATE (
SUM (Master[Value]) * SUM (Master[Value]),
FILTER (
ALL ( Master ),
Master[Date] <= MAX ( Master[Date] )
)
)``````

But the result is

Anyone can help me for the correct DAX to get 49, 50, and 54 as the running sum?

Any help will be greatly appreciated! Thank you.

1 ACCEPTED SOLUTION
Super User

@gggar

Use the formula this way:

``````Value Measure =
var _date =  MAX(Master[Date]) return
CALCULATE(
SUMX(VALUES(Master), Master[Value] * Master[Value]),
Master[Date] <=_date
)``````

Did I answer your question? Mark my post as a solution! and hit thumbs up
2 REPLIES 2
Helper I

@Fowmy , thanks a lot!

Super User

@gggar

Use the formula this way:

``````Value Measure =
var _date =  MAX(Master[Date]) return
CALCULATE(
SUMX(VALUES(Master), Master[Value] * Master[Value]),
Master[Date] <=_date
)``````

Did I answer your question? Mark my post as a solution! and hit thumbs up

Announcements

#### Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

#### Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

#### Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors