Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
vignesh_s
Creator
Creator

adding extra field

hi all,

i have loaded a file as follows

Fund     Curency     Value

A               X               20

B               Y               30

C               Z               40

D               P               50

I wanna added an extra field such that,in curency field i have "P",that value should b populated as a new filed,it should happn dynamicaly i.e.,

output:

Fund     Curency     Value      Value1

A               X               20          50

B               Y               30          50

C               Z               40          50

D               P               50          50

1 Solution

Accepted Solutions
Anil_Babu_Samineni

My bad, this will work

Sample:

LOAD * Inline [

Fund   ,  Curency ,    Value

A      ,         X           ,    20

B       ,        Y           ,    30

C        ,       Z           ,    40

D ,              P           ,    50

];

Left Join(Sample)

LOAD Max(Value) as Value1 Resident Sample;

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

5 Replies
Anil_Babu_Samineni

Sum(TOTAL Value) will deserve

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anil_Babu_Samineni

My bad, this will work

Sample:

LOAD * Inline [

Fund   ,  Curency ,    Value

A      ,         X           ,    20

B       ,        Y           ,    30

C        ,       Z           ,    40

D ,              P           ,    50

];

Left Join(Sample)

LOAD Max(Value) as Value1 Resident Sample;

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
surendraj
Specialist
Specialist

load * ,if(Curency = 'P',Value) as value1 inline [

Fund,    Curency  ,   Value,

A,              X   ,            20,

B ,              Y ,              30,

C ,             Z  ,             40,

D ,             P ,              50,

];

it should be

Capture.PNG

vishsaggi
Champion III
Champion III

Is this Value1 should hold max value always or it should be driven by Currency?

Extending Anil's script may be try like below:

Currency:

LOAD * INLINE [

Fund,  Currency, Value

A, X, 20

B, Y, 30

C, Z, 40

D, P, 50

];

LEFT JOIN(Currency)

LOAD Currency,

     Sum(Value) AS Value1

Resident Currency

WHERE Currency = 'P'

Group By Currency;

Then using a straight table add

Dim: Fund, Currency, Value

Expr: = Sum(TOTAL Value1)

You can see below:

Capture.PNG

el_aprendiz111
Specialist
Specialist

Hi,

tmp:
LOAD * Inline
[
Fund,Curency,Value
A,X,20
B,Y,30
C,Z,40
D,P,50
]
;


MX:
LOAD Max(Value) AS MxCurency Resident tmp Group By Curency;

LET vP = Peek('MxCurency');

sumary:
LOAD *, $(vP) AS Value1 Resident tmp;

TRACE $(vP);

DROP Table tmp,MX;