You need to sign in to do that
Don't have an account?
Chandradeep Mishra
SOQL Question group by and weight avg
Hi,
I have data like that
Xyz 4
Xyz 4
Xyz 4
Xyz 4
AB 5
AB 5
CD 6
YD 4
I want to group by and do sum only for the distinct rows and divide each with sum. for example :
avg would
Xyz 4
AB 5
CD 6
YD 4
sum 19 and avg would be
Xyz 4 4/19
Xyz 4 4/19
Xyz 4 4/19
Xyz 4 4/19
AB 5 5/19
AB 5 5/19
CD 6 6/19
YD 4 4/19
help me on this
I have data like that
Xyz 4
Xyz 4
Xyz 4
Xyz 4
AB 5
AB 5
CD 6
YD 4
I want to group by and do sum only for the distinct rows and divide each with sum. for example :
avg would
Xyz 4
AB 5
CD 6
YD 4
sum 19 and avg would be
Xyz 4 4/19
Xyz 4 4/19
Xyz 4 4/19
Xyz 4 4/19
AB 5 5/19
AB 5 5/19
CD 6 6/19
YD 4 4/19
help me on this
It is not possible using group by SOQL query to sum unique records but we can do using custom logic.