cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Helper II

## Issue with DATEDIFF

All,

PBI newbie here. Maybe I'm missing something, not real sure, but I have a measure that I'm using to calculate the average age of an opportunity from our CRM data. It works when coupled with opportunities that have both a createdon date and an actualclosedate; these are both columns in my table. I created another column with the Today() function as the value. What I'm trying to accomplish is show the average age based on the dates(createdon vs today's date, or createdon vs actualclose date) of each opportunity. Thoughts?

Current working formula:

Avg Age = AVERAGEX (opportunity, DATEDIFF ( [createdon], [actualclosedate], DAY)

Tried:

Opp Avg Age = AVERAGEX (opportunity, DATEDIFF ([created on], [today], DAY) >>> The result I get is ever single column added up and averaged (so instead of individual number of days per opportunity, it's just entire column added and averaged)

1 ACCEPTED SOLUTION
Super User

Hi @swebb

Avg Age =
AVERAGEX (
opportunity,
DATEDIFF ( [createdon], COALESCE ( [actualclosedate], TODAY () ), DAY )
)

3 REPLIES 3
Super User

Hi @swebb

Avg Age =
AVERAGEX (
opportunity,
DATEDIFF ( [createdon], COALESCE ( [actualclosedate], TODAY () ), DAY )
)

Helper II

Actually, I think we can mark this resolved. I was looking through the records and have determined the counts are accurate. Thank you!

Helper II

A bit closer, maybe. Still getting some really odd numbers, in to the thousands.

Announcements

#### Fabric certifications survey

Certification feedback opportunity for the community.

#### 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