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
andwele
Frequent Visitor

Daily average for a full month

I'm stuck I've tried searching for the solution to this in multiple ways and if the solution is obvious I appologize. 

I have data from multiple sites with vendors different vendors picking up tons from each site. I would like to create a measure that gets the daily average on a full month basis for each vendor. I have a seperate Date table created using CALENDARAUTO with year, month, month number, quarter, year month number, and year month. 

 

I'm able to get the average based on the distinct count using these two measures:

 

Total Tons = SUMX('INBOUND (2)', 'INBOUND (2)'[TONS])

 

Average Tons Per Day  = AVERAGEX( VALUES(DATES[Date]), [Total Tons])

 

Here is my source data 'INBOUND (2)':

 

DATEVendorTICKETSITE_TICKETTONSSITEID
9/6/2020 0:00Vendor11303298130329826.57Site1
8/26/2020 0:00Vendor11303185130318524.11Site1
9/11/2020 0:00Vendor46051733605173323.96Site5
9/5/2020 0:00Vendor11303290130329025.41Site1
9/11/2020 0:00Vendor11303350130335024.34Site1
8/18/2020 0:00Vendor11303104130310426.15Site1
8/20/2020 0:00Vendor16051494605149424.69Site5
8/26/2020 0:00Vendor16051558605155824.53Site5
8/20/2020 0:00Vendor11303123130312326.19Site1
9/7/2020 0:00Vendor11303307130330724.15Site1
9/10/2020 0:00Vendor11303333130333325.54Site1
8/28/2020 0:00Vendor11303207130320724.77Site1
9/2/2020 0:00Vendor3234556216123.6Site3
8/22/2020 0:00Vendor11303145130314525.63Site1
8/26/2020 0:00Vendor27044875704487524.99Site4
8/16/2020 0:00Vendor16051458605145830.01Site5
8/21/2020 0:00Vendor16051504605150424.73Site5
8/21/2020 0:00Vendor27044832704483223.98Site4
8/19/2020 0:00Vendor16051487605148730.36Site5
8/20/2020 0:00Vendor16051495605149530.08Site5
8/17/2020 0:00Vendor25139851513984824.03Site2
8/24/2020 0:00Vendor16051534605153430.4Site5
8/17/2020 0:00Vendor16051465605146530.13Site5
9/2/2020 0:00Vendor11303257130325724.55Site1
9/7/2020 0:00Vendor11303308130330826.48Site1
9/7/2020 0:00Vendor37044977704497724.05Site4
9/6/2020 0:00Vendor25139945513994224.81Site2
9/11/2020 0:00Vendor25139970513996722.97Site2
8/22/2020 0:00Vendor11303146130314624.56Site1
8/25/2020 0:00Vendor16051546605154630.14Site5
8/26/2020 0:00Vendor16051559605155930.44Site5
8/16/2020 0:00Vendor11303085130308525.13Site1
8/23/2020 0:00Vendor25139872513986923.77Site2
8/27/2020 0:00Vendor16051569605156930.18Site5
8/28/2020 0:00Vendor16051583605158330.02Site5

 

4 REPLIES 4
amitchandak
Super User
Super User

@andwele , Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

Try if this can work

Average Tons Per Day = calculate(AVERAGEX( VALUES(DATES[Date]), [Total Tons]) , allexcept(Date, Date[Month-year]))

lbendlin
Super User
Super User

So many questions 🙂

 

 what is a full month? with or without weekends and holidays? Where are these sites located? What are the weekend and holiday rules at these sites?  Do you only want to sed the daily average for completed months or do you also want to show the Month To Date average for the current month?

 

Here's your sample data.  Neither August nor September are complete. Are you looking more for a sliding window average maybe?

 

lbendlin_0-1600126463241.png

 

 

Sorry I didn't have a chance to get back to this forum there are so many competing issues with my job and went into a total crisis mangement with work pretty much right after I posted this. Anyway thank you for view my post. to answer your questions while my explanation was lacking what I want is pretty straight forward. I want to calculate the average based on all the days in the month that have occured. so if I'm looking at data today 10/21/2020 I would like the month average to be the total tons divided by 21 days. if I look at september 2020 I would like to see the month average to be the total tons divided by 30. The vendors are servicing the sites as they are called including on weekends and holidays so there is no distinction there but they are not called on all days. So Power BI understandably divides the total by the total number of days they provided service I just don't know how to not do that.

Create a calculated column in your calendar table that computes the number of days in that date's month.

Use that column value as the denominator.

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.

Top Solution Authors