Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
waleeed_mahmood
Creator
Creator

AVG of values Per MPG

Hello,

I hope you are doing well.

I have the following table:

OwnerMPGMCChange
004AACP33
004AACP54
004AACP585
004AACP5806
0054JSD255
0054JSD2513
0054JSD2529
0054JSD2532
0054JSD2547

 

Im trying find the avg of every MPG. so my resulting table would look something like this:

OwnerMPGAVG(Change)
004AA4.5
0054J5.2

 

And i cannot get those numbers for the life of me. I am getting 5.58 for 4J. I have no other table in my app. Just that table.

Thank you.

Labels (2)
3 Replies
Taoufiq_Zarra

@waleeed_mahmood 

this is what I get :

Capture.PNG

check if you have decimal values in Change like 5.002454... instead of 5 !

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Kushal_Chawda

@waleeed_mahmood  Looks like you have decimal numbers in your Change column.  Rounding of Change column can help you to get the same number . Try below

= avg(floor(Change))

or

=avg(round(Change))

ramchalla
Creator
Creator

@waleeed_mahmood 

you can try the below code.

Test:

LOAD
Owner,
MPG,
MC,
Change
FROM [lib://dvSourceDataPath/ICO_Recharges_MI/Test/Book1.xlsx]
(ooxml, embedded labels, table is Sheet1);

Left Join (Test)
Test_Avg:
Load

Owner,
MPG,
Avg(Change) as ChangeAvg

Resident Test
Group By
Owner,
MPG,
;