dimanche 22 novembre 2020

Correct query for sum and average two groups

I have a calculated query called group that has created two groups:

IF [Id] = 'A' THEN 'Group1'

ELSEIF [Id] = 'B' THEN 'Group2'

ELSE 'none'

END

I wish to create a calculated field on top of this that will sum the values if it is in Group1 and average the values if it is in Group2

This is what I am doing:

sum(if [group] = 'Group1') AND avg(if [ group] = 'Group2')

Now add these values:

 zn(sum(if [(group)]= 'Group1' end))
+
zn(avg(if [(group)] = 'Group2' end))

Any suggestion is appreciated, I am still researching

Thank you

enter image description here

Aucun commentaire:

Enregistrer un commentaire