cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kressb
Helper III
Helper III

Easy Sum Based on Dates Current/Previous Question

I have a Table with two columns - month, a #. I am trying to make a third calculated column that adds the current month with the lines above it to get a total. ex:

MonthNumberNumberYTD
7/1/20202323
8/1/20202144
9/1/20202266
10/1/20202288
11/1/202021109
12/1/202023132
1/1/202121153
2/1/202120173
3/1/202123196

I tried:

NumerYTD = calculate(sum(Table[Number]),Filter(Table,Table[Month]<=Table[Month]))

but that just gives me 196 for every line.

TYIA

1 ACCEPTED SOLUTION
camargos88
Super User III
Super User III

@kressb ,

 

Try this code for a new calculated column:

Number YTD = CALCULATE(SUM('Table'[Number]), FILTER('Table', 'Table'[Month] <= EARLIER('Table'[Month])))


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



View solution in original post

1 REPLY 1
camargos88
Super User III
Super User III

@kressb ,

 

Try this code for a new calculated column:

Number YTD = CALCULATE(SUM('Table'[Number]), FILTER('Table', 'Table'[Month] <= EARLIER('Table'[Month])))


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



View solution in original post

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

April Update

Check it Out!

Click here to read more about the April 2021 Updates!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

secondImage

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.