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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
mbd
Helper I
Helper I

Calculating an Average on a Line Chart

Hi, 

 

I'm calculating an average on a line chart as follows:

AvgItemA = Calculate(average(vPlantItemWklyData[WklyItemA]), allselected(vPlantItemWklyData))

 

I've used this form on another average in another chart and it works great. 

I this line chart I'm getting an incorrect answer. PowerBI is returning an average of 0.95 and the answer should be 1.62.

 

What am I doing wrong?

 

Thanks

 

Here's my data

DateItemWklyItemA
9/14/2009 0:00ItemA1.945312
10/5/2009 0:00ItemA1.894224
11/2/2009 0:00ItemA1.762736
11/4/2009 0:00ItemA1.762736
11/30/2009 0:00ItemA1.779186
1/7/2010 0:00ItemA1.801572
1/8/2010 0:00ItemA0.900786
2/1/2010 0:00ItemA1.998774
3/1/2010 0:00ItemA1.95201
3/29/2010 0:00ItemA1.986208
4/5/2010 0:00ItemA0.976768
4/26/2010 0:00ItemA1.998508
5/10/2010 0:00ItemA0.995925
5/25/2010 0:00ItemA0.994673
5/26/2010 0:00ItemA0.994673
6/7/2010 0:00ItemA1.9206
6/8/2010 0:00ItemA0.9603
6/21/2010 0:00ItemA1.908812
7/6/2010 0:00ItemA1.947682
7/19/2010 0:00ItemA0.993915
8/2/2010 0:00ItemA1.945164
8/16/2010 0:00ItemA1.861134
8/30/2010 0:00ItemA1.932866
2 ACCEPTED SOLUTIONS

Your questions led me to my solution. 

 

I was summing data points for the week that should not have been summed. Then when I calculated the average it averaged all the data points. Once I correct this I got the correct average.

 

Thanks!

View solution in original post

v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @mbd,

 

Great to hear the problem got resolved! Could you accept your reply above as solution to close this thread? Smiley Happy

 

Regards

View solution in original post

4 REPLIES 4
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @mbd,

 

Based on my test, the result of the measure is 1.62. 

 

What column are you showing as Axis on the Line Chart? Do you have any Slicer applied on your report? Could you share a sample pbix file which can reproduce the issue, so that we can help further investigate on it? You can upload it to OneDrive or Dropbox and post the link here. Do mask sensitive data before uploading.Smiley Happy

 

Regards

Your questions led me to my solution. 

 

I was summing data points for the week that should not have been summed. Then when I calculated the average it averaged all the data points. Once I correct this I got the correct average.

 

Thanks!

v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @mbd,

 

Great to hear the problem got resolved! Could you accept your reply above as solution to close this thread? Smiley Happy

 

Regards

Hi, 

 

I'm still 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. 

 

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

 

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

 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.