Skip to main content
cancel
Showing results for 
Search instead 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.

Reply
kressb
Helper V
Helper V

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
Community Champion
Community Champion

@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
Community Champion
Community Champion

@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!



Helpful resources

Announcements
Microsoft Fabric Learn Together

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

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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