Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
realpixel
Contributor III
Contributor III

sum expression

Hello,

I have following chart.

Nbre TA and Nbre T are an expression

I want to have in the field “RES” the result under

Someone have an idea to have the following result

18,75 = (3/16)*100

25= (4/16)*100

56,25=(9/16)*100

ZP

Nbre TA

Nbre T

CAM

LOC

RES

ZP

2

3

ALCL

-

18,75

ZP

3

4

SOCO

SOCO

25

ZP

5

9

SOCO

-

56,25

10

16

100

1 Solution

Accepted Solutions
Nicole-Smith

The following will make sure there is something in the ZP field (makes sure the length is at least one character):

sum(total aggr(count({<ISO={'20'},ZP={'?*'}>}distinct HMCONT) + (count({<ISO={'40'},ZP={'?*'}>}distinct HMCONT)*2),ZP,CAM,LOC))*100

View solution in original post

17 Replies
Nicole-Smith

Expression would be:

=[Nbre T]/sum(total [Nbre T])*100

Example file also attached.

alexandros17
Partner - Champion III
Partner - Champion III

The expression for RES field is:

sum(NbreT) / sum(TOTAL NbreT) * 100

Hope it helps

Not applicable

Hi,

[Nbre T] is an expression, this makes Sum(TOTAL not work in the given formula.

Could you give us the formula of [Nbre T] and the dimensions of your chart? It seems the best would be to adapt this formula to get the total...

realpixel
Contributor III
Contributor III
Author

Thank you all for replies, you are right Pierre, the total sum does not work with tese expressions.

Find under the formula for NbreT

count(distinct if( ISO='20', HMCONT)) + (count(distinct if( ISO='40', HMCONT))*2)

dimensions are CAM and ZP

Nicole-Smith

count(distinct if( ISO='20', HMCONT)) + (count(distinct if( ISO='40', HMCONT))*2) can be written a bit better:

count({<ISO={'20'}>}distinct HMCONT) + (count({<ISO={'40'}>}distinct HMCONT)*2)

Then the RES expression would be:

count({<ISO={'20'}>}distinct HMCONT) + (count({<ISO={'40'}>}distinct HMCONT)*2) /

sum(aggr(count({<ISO={'20'}>}distinct HMCONT) + (count({<ISO={'40'}>}distinct HMCONT)*2),CAM,ZP)) * 100

realpixel
Contributor III
Contributor III
Author

The expression gives me in RES column, the value under

RES

67.67

52,00

89.98

The data are wrong

It will be

18,75

25

56,25

Nicole-Smith

I think I forgot the TOTAL keyword:

count({<ISO={'20'}>}distinct HMCONT) + (count({<ISO={'40'}>}distinct HMCONT)*2) /

sum(total aggr(count({<ISO={'20'}>}distinct HMCONT) + (count({<ISO={'40'}>}distinct HMCONT)*2),CAM,ZP)) * 100

realpixel
Contributor III
Contributor III
Author

I try this expression but the result is always false

RES:

1.55

2,55

3,21

Nicole-Smith

Can you just put this in the chart and tell me what it is returning (once with the total and once without):

1.  sum(aggr(count({<ISO={'20'}>}distinct HMCONT) + (count({<ISO={'40'}>}distinct HMCONT)*2),CAM,ZP))

2.  sum(total aggr(count({<ISO={'20'}>}distinct HMCONT) + (count({<ISO={'40'}>}distinct HMCONT)*2),CAM,ZP))