Forum Discussion
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
| Date | Item | WklyItemA |
| 9/14/2009 0:00 | ItemA | 1.945312 |
| 10/5/2009 0:00 | ItemA | 1.894224 |
| 11/2/2009 0:00 | ItemA | 1.762736 |
| 11/4/2009 0:00 | ItemA | 1.762736 |
| 11/30/2009 0:00 | ItemA | 1.779186 |
| 1/7/2010 0:00 | ItemA | 1.801572 |
| 1/8/2010 0:00 | ItemA | 0.900786 |
| 2/1/2010 0:00 | ItemA | 1.998774 |
| 3/1/2010 0:00 | ItemA | 1.95201 |
| 3/29/2010 0:00 | ItemA | 1.986208 |
| 4/5/2010 0:00 | ItemA | 0.976768 |
| 4/26/2010 0:00 | ItemA | 1.998508 |
| 5/10/2010 0:00 | ItemA | 0.995925 |
| 5/25/2010 0:00 | ItemA | 0.994673 |
| 5/26/2010 0:00 | ItemA | 0.994673 |
| 6/7/2010 0:00 | ItemA | 1.9206 |
| 6/8/2010 0:00 | ItemA | 0.9603 |
| 6/21/2010 0:00 | ItemA | 1.908812 |
| 7/6/2010 0:00 | ItemA | 1.947682 |
| 7/19/2010 0:00 | ItemA | 0.993915 |
| 8/2/2010 0:00 | ItemA | 1.945164 |
| 8/16/2010 0:00 | ItemA | 1.861134 |
| 8/30/2010 0:00 | ItemA | 1.932866 |
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!
Hi mbd,
Great to hear the problem got resolved! Could you accept your reply above as solution to close this thread? :smileyhappy:
Regards
4 Replies
- v-ljerr-msftMicrosoft 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.:smileyhappy:
Regards
- mbdHelper I
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-msftMicrosoft Employee
Hi mbd,
Great to hear the problem got resolved! Could you accept your reply above as solution to close this thread? :smileyhappy:
Regards