Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Scripting question / Adding two columns

Hello everyone,

I am facing a (i'm sure it is) really easy problem...

I have two tables, let's say :

TableA :

LOAD

dim1,

dim2,

dim3,

metricA

FROM a.qvd (qvd);

TableB :

LOAD

dim1,

dim2,

metricB

FROM b.qvd (qvd);

In the end, i'd like to have a Table C with the following columns :

dim1,

dim2,

dim3,

metricA + metricB

Thanks a lot for your help.

Damien

1 Reply
swuehl
MVP
MVP

If I understood correctly, you should be able to join the two tables and then do a rangesum of fields metricA and metricB, maybe like this (untested):

TableA :

LOAD

dim1,

dim2,

dim3,

metricA

FROM a.qvd (qvd);

left join (TableA) LOAD

dim1,

dim2,

metricB

FROM b.qvd (qvd);

Result:

LOAD *, rangesum(metricA,metricB) as SumOfMetrics resident TableA;

drop table TableA,

//drop fields metricA,metricB; //drop if needed