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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
unclejemima
Post Patron
Post Patron

Average qty sold per working days

I've got a table called "TranData"" what includes a Inventory Part, a Quantity and a Date.

 

I'm trying to build an average of Quanity sold for only working days.  The business is open Mon-Sat, closed on Sunday.  I'm looking then to get averages of Quantity sold Per Monday, Per Tuesday, etc.  So I can get a idea of what is the true average of each specific day, example on Monday's over time we sold this product X many times.

 

Looking for advice 🙂

 

 

12 REPLIES 12
Greg_Deckler
Super User
Super User

Check out my quick measure for Net Work Days in the Quick Measure gallery. You should just have to tweak it as mine excludes Sat and Sun.

 

https://community.powerbi.com/t5/Quick-Measures-Gallery/Net-Work-Days/m-p/367362

 


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

This looks good thanks, but I think I might be explaining this wrong 🙂  Let me try again...

 

I'm able to build this, this is sample data for one month that shows the sales of a specific product per hour for each day of the week.


This is straight correct for the month of Feb 2018. and works good for showing the TOTAL sales, set per hour, per day of the week.

 

sample.PNG

 

Problem comes when I try and avearge the numbers per hour based on the day of the week.

 

I can change this to "Average" but the numbers are all out of whack.

sample2.png

Use 11 Am for example.  If I count in Feb 2018, looking at there are 4 saturdays in a month, there were 17 of the product sold at 10am on Saturday, so it should average to 4.25...but instead its saying 1.42.

 average wrong2.PNG

 

 

I'm not sure why the average option (instead of sum) is not working, and I assume I need to make a calc column to average each day of the week?


Example, Monday = if (trandata[date] = Monday, then...? and I'd have to do it by day of the week?

There must be a logical way for this that is easy to do to get daily average based on the info I have?  I'm so close 😉

Anyone?  Do you guys need more screenshots/detail to help with a solution?

Going to need some sample/example data for this one to see what is going on, too difficult to understand what might be happening. If you can share the PBIX file, great, otherwise:

 

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Here is some example data. 

 

Hope this works. I can't post the power bi file because its private info.  Wish I could...would make it much easier 🙂

 

This shows basically the raw data I have...

 

snip2.PNG

 

What I'm trying to do is get this...

snip1.PNG

Hi

 

Please use Matrix visualization and put hours as row and day as column. Qty would be put in values. Click on Qty and select average. It will do what you want to achieve.

 

I hope it helps

Your talking instead of doing SUM of quantity, for it to do AVERAGE of quantity, correct?

I tried this and the numbers it gives me are not the averages per day/hour...it looks almost as if its averaging against everything (all hours, all days average)

 

Could I create a new column or measure that would figure the average per day?

Are you sure about it. Please see input data and output and check if you are doing the same.

 

RegardsDataSource.PNGOutput.PNG

Newbie1, did you change your qtys in your example to average to see if it gave wonky numbers for the averages like mine is???

They are averages. The formula is (Total quantity sold during certain hours on a particular day/Frequency of days). For eg. if at 11.00, 6 items were sold on Friday and at 11.00 4 items were sold next Friday. Then, average would be (6+4)/2=5.

 

Hope it helps.

Your numbers don't look like averages...can you set to average and see what your numbers look like?

-mark

Here is what it looks like with the raw data...as "sum" its perfect...but if i change quanity to "average" the average looks very wrong.

 

data2.PNG

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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