Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Average based on time values

I have 2 tables... One that holds my sales stats per day.  And another table that I'm using that has all my Date/Week/Month columns and created a realtionship between my Sales table and my Calendar table based on the Date column in my Sales table and the Date column in my Calendar table.


I'm now trying create a DAX that will give me an average sales, based on a slicer of "weeks" (and I'm choosing 3 weeks), and grouping the sales by Day of Week (Sun, Mon, Tue, Wed, Th, Fri, Sat).


When I use the Clustered Column Chart, it automatically sums the sales per weekday, and does not allow me to do or chose an "average" as a choice.



Any ideas?

Super User IV
Super User IV

@Jazzyfey11 , if you have created as the measure then it will not give an option to change the aggregation


sales measure = sum(sales[sales])

if it giving/showing sum then it should give an average. If it is not showing both means data type is not number, change it.


If sorting is an issue. you should use a sort column.

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!

Thanks.  You're absolutely right, looking at the sales, I did have it set as a measure based on the original data table I am calculating to. 


AllSales = Calculate(sum(SalesData[TotalSalesValue]),SalesData[ProductSalesName)="Sales")


And I think that's where I'm stuck.  Because it is a measure.


When using that measure inside the graph, grouping it by WeekDay, and a slicer that is choosing how many weeks to calculate, that's where I'm stuck in trying get an average for each weekday, instead of a total for each weekday.

Does this expression give your expected result?  It should do same filter on ProductSalesName but average instead of Sum.


AllSales = Calculate(Average(SalesData[TotalSalesValue]),SalesData[ProductSalesName)="Sales")


Or, if you want average per week you can reference the measure above in

Avg Weekly Sales = AVERAGEX(VALUES('Calendar'[Week'), [AllSales])


If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.



Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.

@mahoneypa HoosierBI on YouTube

Thanks mahoneypat,

So I did try the


AllSales = Calculate(Average(SalesData[TotalSalesValue]),SalesData[ProductSalesName)="Sales")


And based on how the SalesData table is laid out, at a transactional level (each day, each salesperson,productsales name, and salesvalue), it is averaging the sales, but it looks like per sales person, instead of the total sales for that day..


So the total sales per each Sunday was:

Sunday 1 = 4143

Sunday 2 = 2861

Sunday 3 = 3390


The average for those 3 sundays should be: 3464


Doing the DAX above, it's giving me 17, which is more the average per sales agent, instead of the total for Sunday..



Hi @Jazzyfey11 ,

Not certain what did 17 represent under this measure. Could you consider sharing some sample data or sample file for further discussion? It would let us help you better to solve this issue.


Best Regards,
Yingjie Li

@Jazzyfey11 This looks like a measure aggregation problem. See my blog article about that here:

The pattern is:
MinScoreMeasure = MINX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
MaxScoreMeasure = MAXX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
AvgScoreMeasure = AVERAGEX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])


@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!

Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

So, Greg_Deckler,

Using this layout for AverageX

AvgScoreMeasure = AVERAGEX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])


Could it then look something like this:


SalesAverage =
Var Sales = Calculate(sum(SalesData[TotalSalesValue]),SalesData[ProductSalesName)="Sales")


The Var Sales was the original DAX I used to get the sum of the Sales Value looking up the column data of Product Sales Name that had "Sales" in the row.
Using this, which feels like it's in the right vein of your method, it still sums up the total sales.
I know I'm missing something.

Helpful resources


Happy New Year from Power BI

This is a must watch for a message from Power BI!

December Update

Check it Out!

Click here to read more about the December 2020 Updates!

Community Blog

Check it Out!

Click here to read the latest blog and learn more about contributing to the Power BI blog!

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
Top Kudoed Authors