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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Gazsim44
Helper III
Helper III

Average from measure with Datediff

Hi All, 

 

I have a measure which I am using to calculate the hours an employee is on site by using the first and last times they are utilising the access control system.

 

Hours Present = DATEDIFF(MIN('Access Report'[Date/time]),MAX('Access Report'[Date/time]),MINUTE)/60

 

However we now need to calculate the average hours present on any given day of the week based on the employees selected / and / or month / date etc. (using slicers as filters). 

 

A sample of my table is attached.

 

Capture.PNG

Thanks

 

1 ACCEPTED SOLUTION

hi  @Gazsim44 

It's pleasant that your problem has been solved, 😁

For measure totals problem. it is a common problem, there is another blog for you refer to: 
https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

 

please accept my reply as answer, that way, other community members would easily find the solution when they get same issues.

 

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-lili6-msft
Community Support
Community Support

hi  @Gazsim44 

here is a similar post for you refer to:

https://community.powerbi.com/t5/Desktop/convert-measures-to-column-for-correct-average/m-p/1145598

 

If you still have the problem, please share your sample pbix file and your expected output.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi, I've found that this solution from @Greg_Deckler  has successfully managed what I needed.

 

https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

 

The issue was initially in the totals not calculating correctly so once resolved obtaining the average was relatively easy!

 

Thanks, 

hi  @Gazsim44 

It's pleasant that your problem has been solved, 😁

For measure totals problem. it is a common problem, there is another blog for you refer to: 
https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

 

please accept my reply as answer, that way, other community members would easily find the solution when they get same issues.

 

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

@Gazsim44 , refer to my blog on this. You need to give correct row context using summarize or values

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

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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