cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Get average of DATEDIFF

Hi,

 

I'm trying to create a report that shows the average number of days it takes from opening a position, to a new employee starting at the firm.

 

The startDate is in a different table than the Creation date. I have created a measure:

 

DaysOpen = 

    DATEDIFF ( MIN ( 'TableA'[CreationDate] );

                       MIN ( 'TableB'[StartDate] );

                               DAY )

 

When I use the measure for each position (record), this works fine. However, when I try to aggregate this, say I want the average per Department, I get stuck.

 

I don't think I could use AVERAGEX, since the DATEDIFF is calculated over different tables. 

 

Any thoughts on how I should handle this?

 

Kind Regards,

 

M.

 

2 REPLIES 2
Highlighted
Super User IX
Super User IX

Re: Get average of DATEDIFF

@PowerBI_M , refer my blog on this , you need a common context for that

https://community.powerbi.com/t5/Community-Blog/Decoding-Direct-Query-in-Power-BI-Part-2-Date-Differ...



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Highlighted
Microsoft
Microsoft

Re: Get average of DATEDIFF

Hi @PowerBI_M ,

 

Just use summarize table as first parameter for AVERAGEX, Would you please inform us more detailed information( your  data(by OneDrive for Business)) if possible? Then we will help you more correctly.

 

Best Regards,

Dedmon Dai

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Upcoming Events

Experience what’s next for Power BI

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

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors