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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
abujouz86
Helper II
Helper II

Calculate average per hour per day

Hi - I'm new to dax and power bi, love it but so much still to learn!

 

I'm working with fulfillment data and I'd like to calculate how many shipments we're averaging per hour per day. It's a very large dataset and packing slips are unique identifier and I've included a small sample below. I am having troubling writing a formula to calculate the average number of packing slips per hour per day.

 

Would someone help with a hint to get started? Many thanks for advice!

 

Annotation 2020-03-24 203031.png

 
 
1 ACCEPTED SOLUTION
v-gizhi-msft
Community Support
Community Support

Hi,

 

I think it is easily to reach your reqiurement.

For test, i make a small change to your sample data:

36.PNG

Please try to create this calculated column:

Day&Hour = 'Table'[Created date]&"-"&HOUR('Table'[Created time])

Then create this column to show the Packing slip number:

Packing slip Number = VALUE(RIGHT('Table'[Packing slip],LEN('Table'[Packing slip])-4))

Choose above two columns as a table visual, the result shows the average of Packing slip number per day per hour:

37.PNG

Here is my test pbix file:

pbix 

Hope this helps.

 

Best Regards,

Giotto Zhi

 

View solution in original post

6 REPLIES 6
v-gizhi-msft
Community Support
Community Support

Hi,

 

I think it is easily to reach your reqiurement.

For test, i make a small change to your sample data:

36.PNG

Please try to create this calculated column:

Day&Hour = 'Table'[Created date]&"-"&HOUR('Table'[Created time])

Then create this column to show the Packing slip number:

Packing slip Number = VALUE(RIGHT('Table'[Packing slip],LEN('Table'[Packing slip])-4))

Choose above two columns as a table visual, the result shows the average of Packing slip number per day per hour:

37.PNG

Here is my test pbix file:

pbix 

Hope this helps.

 

Best Regards,

Giotto Zhi

 

Thank you Giotto, so helpful! 

Ashish_Mathur
Super User
Super User

Hi,

Share data in a form that can be pasted in an Excel file and on that sample data, show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks for your message, I've pasted the data sample 

 

Invoice accountSales orderPacking slipVersionShip dateMode of deliveryCreated dateCreated time
69056641961467013PKS-00442659PKS-00442659.11/1/2019STANDARD1/1/201912:54:37 AM
69074513861506593PKS-00442660PKS-00442660.11/1/2019STANDARD1/1/201912:56:40 AM
68586467061506650PKS-00442661PKS-00442661.11/1/2019STANDARD1/1/201912:56:49 AM
70040415161506706PKS-00442662PKS-00442662.11/1/2019STANDARD1/1/201912:57:02 AM
68554320961506750PKS-00442663PKS-00442663.11/1/2019OVERNIGHT1/1/201912:57:13 AM
70044850761506760PKS-00442664PKS-00442664.11/1/2019STANDARD1/1/201912:57:19 AM
70044853961506807PKS-00442665PKS-00442665.11/1/2019STANDARD1/1/201912:57:27 AM
70044856461506836PKS-00442666PKS-00442666.11/1/20192 DAY1/1/201912:57:32 AM

Well, you could create an Hour column, HOUR([Created time]) and then do something like this:

 

Measure =

VAR __Table = 

 GROUPBY(

    'Table',

    [Hour],

    "__Count",COUNTX(CURRENTGROUP(),[Invoice account])

  )

RETURN

  AVERAGEX(__Table,[__Count])



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

As requested in my previous message, for the data that you have shared, show the exact expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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

Users online (2,342)