Showing results for 
Search instead for 
Did you mean: 
Helper I
Helper I

Weighted Average

Good Afternoon,


I've been struggling with an issue in my task.


My data looks like:


Date                  Company                  Country              Orders                     Type                Rotation Index Value
1/01/2017            Apple                      EEUU                   5                            Day                            4.5

1/01/2017            Google                    EEUU                   8                            Day                            3.5

1/01/2017            Amazon                  EEUU                   2                            Day                            9.5

1/01/2017            Apple                      EEUU                   3                            Week                         2

1/01/2017            Google                    EEUU                   1                            Week                         6

1/01/2017            Amazon                  EEUU                   9                            Week                         1

2/01/2017            Apple                      EEUU                   9                            Day                            9

2/01/2017            Google                    EEUU                   0                            Day                           5

2/01/2017            Amazon                  EEUU                   2                            Day                            2

3/01/2017            Apple                      EEUU                   5                            Day                            7

3/01/2017            Google                    EEUU                   7                            Day                           8

3/01/2017            Amazon                  EEUU                   1                           Day                            9.5


8/01/2017            Apple                      EEUU                   6                            Week                         4.5

8/01/2017            Google                    EEUU                   4                            Week                        3.5

8/01/2017            Amazon                  EEUU                   10                          Week                         9.5


31/01/2017          Apple                      EEUU                   3                            Month                        2.5

31/01/2017          Google                    EEUU                   1                           Month                        0.5

31/01/2017          Amazon                  EEUU                   6                          Month                         3.5



So what I want to do is to show in a chart the "Rotation Index Value" weighted by the "Orders". The problem is that I need to show the value for each day, last day of the week and last day of the month.


As you can see the column "Type" tells me if the day is a end of day, end of week or end of month(Day-Week-Month). I will put a Slicer that will choose between these three options when I pass from Month to Week or Day in the graphic (as it is needed the value of the last day of the Month/Week, not a sum or the Average, Maximum, etc.).


The problem is that as you can see I need to give a value for example for day 1, which would be (4.5*5 + 3.5*8 + 9.5*2) / (5+8+2) = 4.63
Now I am only able to give a value that does not weigths my average and just makes the (4.5 + 3.5 + 9.5)/3 = 5.83 --> which is incorrect.

For the end of week is the same procedure, I would neet to weight the different Index Rotation Values with the column Orders just for the day that has the type Week.


How can I perform this weighted average so I can give the value for each day-end of week-end of month?

Maybe I have not explained myself very clear, but many thanks for your time.



(4.5*5 + 3.5*8 + 9.5*2) / (5+8+2) equals to 4.63 but not 3.86. Create a masure using DAX below and check if you get expected result.

Weighted average = CALCULATE(SUMX(Table,Table[Orders]*Table[Rotation Index Value]),ALLEXCEPT(Table,Table[Date],Table[Type]))/CALCULATE(SUM(Table[Orders]),ALLEXCEPT(Table,Table[Date],Table[Type]))



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

Hi Lydia,


Your solution seems a good one but I have an aggregated problem that I forgot to tell.

The column "Orders" is not in my current table but in a table (let's called it Table2) that is related to the actual table of the problem by the "Date"  column.


Is it possible to do your solution but using the column from the Table2?




You can create a Orders column in the current table to bring relevant values of Table2 using DAX, then apply the above DAX formula.

If you have questions about how  to create the Orders column, please post sample data of your Table2.


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


Maybe the following code can help you:


Helpful resources

August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power BI Dev Camp Session 24 without aka link and time 768x460.jpg

Ted's Dev Camp - July 28, 2022

Watch Session 24 of Ted's Dev Camp along with past sessions!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors