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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
mbd
Helper I
Helper I

How to stop calculating average of averages

Hi, 

 

Hi,

 

I'm working on averaging data. I'm averaging inventory data over a time period. The time period and the items are selected in Slicers.

 

Here's the equation I'm using 

AvgInv = Calculate(average(vQuery1[InvQty]), allselected(vQuery1))

 

The equation works great when I select only one item to average.

But when I select more than one item the equation does not work. 

 

It is summing the average of each item and then averaging that for the average of both.

When I select more than one item I want the sum of the average for each item not the average of the averages. 

 

Here's some sample data from the chart. The first three columns are an export from the chart for Item1, the next three are an export for Item2, and the last three are an export when  both items 1 and 2 are selected. So my average should be 5128 (5057+71), not 2564 as shown in the last column.

 

DateItem1InvQtyAvgInv DateItem2InvQtyAvgInv DateItem1&2InvQtyAvgInv
8/24/20095510.445057.33 8/24/200942.4571.13 8/24/20095552.892564.23
8/31/20094116.875057.33 8/31/200929.7471.13 8/31/20094146.612564.23
9/7/20095779.865057.33 9/7/200921.7571.13 9/7/20095801.612564.23
9/14/20095207.165057.33 9/14/200919.8771.13 9/14/20095227.032564.23
9/21/20096110.305057.33 9/21/200913.5571.13 9/21/20096123.852564.23
9/28/20095129.995057.33 9/28/200974.9671.13 9/28/20095204.952564.23
10/5/20094400.315057.33 10/5/200969.8871.13 10/5/20094470.192564.23
10/12/20094588.065057.33 10/12/200956.9671.13 10/12/20094645.022564.23
10/19/20094936.425057.33 10/19/200953.3371.13 10/19/20094989.752564.23
10/26/20095183.445057.33 10/26/200944.0471.13 10/26/20095227.482564.23
11/2/20095085.865057.33 11/2/200983.2471.13 11/2/20095169.102564.23
11/9/20095180.095057.33 11/9/2009172.6671.13 11/9/20095352.752564.23
11/16/20094585.295057.33 11/16/2009171.1271.13 11/16/20094756.412564.23
11/23/20095227.725057.33 11/23/2009160.971.13 11/23/20095388.622564.23
11/30/20095143.795057.33 11/30/2009150.671.13 11/30/20095294.392564.23
12/7/20095636.725057.33 12/7/2009148.4171.13 12/7/20095785.132564.23
12/14/20094826.775057.33 12/14/2009165.8371.13 12/14/20094992.602564.23
12/21/20094428.525057.33 12/21/2009159.2371.13 12/21/20094587.752564.23
12/28/20094011.845057.33 12/28/2009150.371.13 12/28/20094162.142564.23
1/4/20104066.185057.33 1/4/2010138.971.13 1/4/20104205.082564.23
1/11/20104403.925057.33 1/11/2010139.5571.13 1/11/20104543.472564.23
1/18/20103470.685057.33 1/18/2010112.5671.13 1/18/20103583.242564.23
1/25/20105107.095057.33 1/25/2010109.1471.13 1/25/20105216.232564.23
2/1/20105279.145057.33 2/1/201093.6971.13 2/1/20105372.832564.23
2/8/20104566.765057.33 2/8/201086.9471.13 2/8/20104653.702564.23
2/15/20103416.205057.33 2/15/201083.9671.13 2/15/20103500.162564.23
2/22/20104686.535057.33 2/22/201075.471.13 2/22/20104761.932564.23
3/1/20105520.135057.33 3/1/201073.2271.13 3/1/20105593.352564.23
3/8/20104988.315057.33 3/8/201066.6971.13 3/8/20105055.002564.23
3/15/20105300.545057.33 3/15/201063.271.13 3/15/20105363.742564.23
3/22/20104707.985057.33 3/22/2010100.8771.13 3/22/20104808.852564.23
3/29/20105275.725057.33 3/29/201097.0371.13 3/29/20105372.752564.23
4/5/20104380.075057.33 4/5/201083.671.13 4/5/20104463.672564.23
4/12/20104545.175057.33 4/12/201071.1171.13 4/12/20104616.282564.23
4/19/20105161.185057.33 4/19/201080.1171.13 4/19/20105241.292564.23
4/26/20105015.455057.33 4/26/201070.7571.13 4/26/20105086.202564.23
5/3/20105134.165057.33 5/3/201059.2871.13 5/3/20105193.442564.23
5/10/20104934.225057.33 5/10/201017.4171.13 5/10/20104951.632564.23
5/17/20104959.905057.33 5/17/201017.6271.13 5/17/20104977.522564.23
5/24/20105058.765057.33 5/24/201010.1571.13 5/24/20105068.912564.23
5/31/20104433.955057.33 5/31/20107.0371.13 5/31/20104440.982564.23
6/7/20104990.505057.33 6/7/20106.3871.13 6/7/20104996.882564.23
6/14/20104714.105057.33 6/14/201069.0171.13 6/14/20104783.112564.23
6/21/20105054.955057.33 6/21/201061.471.13 6/21/20105116.352564.23
6/28/20105443.075057.33 6/28/201043.6171.13 6/28/20105486.682564.23
7/5/20105292.945057.33 7/5/201036.8671.13 7/5/20105329.802564.23
7/12/20105744.985057.33 7/12/201034.1871.13 7/12/20105779.162564.23
7/19/20105584.795057.33 7/19/201026.2771.13 7/19/20105611.062564.23
7/26/20106221.125057.33 7/26/201020.0271.13 7/26/20106241.142564.23
8/2/20105288.465057.33 8/2/201014.2871.13 8/2/20105302.742564.23
8/9/20106577.395057.33 8/9/20107.671.13 8/9/20106584.992564.23
8/16/20106828.845057.33 8/16/20102.8271.13 8/16/20106831.662564.23
8/23/20106795.965057.33 8/23/20100.4371.13 8/23/20106796.392564.23

 

 

1 ACCEPTED SOLUTION
Eric_Zhang
Microsoft Employee
Microsoft Employee

@mbd

Can you post some raw data instead of the data in chart? Roughly you could try

AvgInv =
CALCULATE ( AVERAGE ( vQuery1[InvQty] ), ALLSELECTED ( vQuery1 ) )
    * DISTINCTCOUNT ( vQuery1[Item] )

View solution in original post

2 REPLIES 2
Eric_Zhang
Microsoft Employee
Microsoft Employee

@mbd

Can you post some raw data instead of the data in chart? Roughly you could try

AvgInv =
CALCULATE ( AVERAGE ( vQuery1[InvQty] ), ALLSELECTED ( vQuery1 ) )
    * DISTINCTCOUNT ( vQuery1[Item] )

Thanks Eric, the formula you provided solved my problem. 

 

Is there a way I can show the data label for just the average inventory I've calculated and not all the other data in the graph?

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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