4 Replies Latest reply: Feb 28, 2012 7:44 AM by Erich Shiino

What's wrong with this set expression?

SUM( { <FIELD_A = FIELD_B> } METRIC)

I want to Sum all values of METRIC where values of FIELD_A match the values of FIELD_B.

• What's wrong with this set expression?

is wrong because the fields FIELD_B has many different values.

you can try this:

SUM( { <FIELD_A = {\$(=Concat(FIELD_B,',')}> } METRIC)

Best regards.

Tonial.

• What's wrong with this set expression?

Hi,

Did you checked is there is any values avilable in both the columns?

-Jai

• What's wrong with this set expression?

Hi,

One alternative to Fernando`s solution is the p() function.

SUM( { <FIELD_A =p(FIELD_B)}> } METRIC)

But if you want to make a test row by row, I suggest you create a flag in script.

LOAD FIELD_A, FIELD_B,

IF( FIELD_A = FIELD_B, 1,0) AS FLAG_AB

...

Then, your set analysis would be

SUM( { <FLAG_AB = {1}}> } METRIC)

Hope this helps,

Erich

• What's wrong with this set expression?

Hi,

Create one Variable vFIELD= '=concat(Chr(39) &FIELD_B&Chr(39),',')'

SUM( { <FIELD_A = {'\$(vFIELD)'}>}METRIC) .u try This method .