Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
wanyunyang
Creator III
Creator III

Average function is not giving correct result

Hi everyone,

In a straight table I'm using avg(TimeStamp1-TimeStamp2) as measure, but the total is not showing me correct average. 

avg.PNG

In this case the total should be 0.462, but it's showing me 0.455. Any idea on this? Anything helps! Thanks in advance! 

 

1 Solution

Accepted Solutions
zzyjordan
Creator II
Creator II

Hi,
It seems you have multiple records for each of your dimension value, and the total you expected is actually an average of your average per your dimension value, so you need something like nested aggregation, and you should use aggr() in your expression in this case.
If you could share some dummy data but with similar data structure as your real one, it will be easier to show how to achieve it.

ZZ

View solution in original post

3 Replies
radmin5253
Contributor III
Contributor III

created a quick test on using the following inline load statement and when I do AVG(Y) in a kpi I get 0.462

T1:
Load * Inline [
X|Y
1|0.44041667
2|0.48364583] (delimiter is '|');

Do you see something different when you use this simple load script.

zzyjordan
Creator II
Creator II

Hi,
It seems you have multiple records for each of your dimension value, and the total you expected is actually an average of your average per your dimension value, so you need something like nested aggregation, and you should use aggr() in your expression in this case.
If you could share some dummy data but with similar data structure as your real one, it will be easier to show how to achieve it.

ZZ
wanyunyang
Creator III
Creator III
Author

You are right, I got the issue and solved it. Thanks for helping!