Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Trying to calculate sum on a metric (DateDiff)

I have a metric calculating the difference between the first and last date in a series of date changes. 

 

Days Close Date Delta = DATEDIFF([First Close Date],[Last Close Date],DAY)
First Close Date is the min of TableName.CloseDate likewise the last close date is the max tablename.closedate table and field. 

My objective is to next create another metric that totals all of the differences that are found. Below is a table showing records and the date difference (delta) if there is one. Currently my formula to total the differences comes to 5 which is the count. I would like to see a total of 572 as an example. The logic seems simple but not being able to use a metric in a sum function is throwing me a wrench. 
 
DicksonJeff_0-1624913925873.png

 

Thanks in advance

2 ACCEPTED SOLUTIONS
AlexisOlson
Super User
Super User

You can use a SUMX like this:

DeltaTotal =
SUMX ( VALUES ( TableName[Column] ), [Days Close Date Delta] )

Where [Column] is whatever column is the lowest level of granularity in your visual.

View solution in original post

Anonymous
Not applicable

Thank you! i had been trying something similar but basing it off of the date field and not the id field. that fixed my issue!

View solution in original post

2 REPLIES 2
AlexisOlson
Super User
Super User

You can use a SUMX like this:

DeltaTotal =
SUMX ( VALUES ( TableName[Column] ), [Days Close Date Delta] )

Where [Column] is whatever column is the lowest level of granularity in your visual.

Anonymous
Not applicable

Thank you! i had been trying something similar but basing it off of the date field and not the id field. that fixed my issue!

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors