Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Sum of Expression values

Hello Guys , i want to add below expression and create new column as Summation. Kindly let me know how to do ?

("AverageHrs"/30)*0.8)

("AverageHrs"/30)

(("AverageHrs"/30)*1.2))

I want to add values of all three expression and assign it new field as Summation

I tried like this but its not working

Sum((("Average Flow3Hrs"/30)*0.8)and ("Average Flow3Hrs"/30) and(("Average Flow3Hrs"/30)*1.2))

as summation,

Thanks,

ravi

19 Replies
YoussefBelloum
Champion
Champion

Hi,

if you want to sum on the script, you should use Group by, example:

Table:

load

     field1,

     field2,

     "Average Flow3Hrs",

     Sum((("Average Flow3Hrs"/30)*0.8)+("Average Flow3Hrs"/30) +(("Average Flow3Hrs"/30)*1.2))

     as Summation

from...

Group by

     field1,

     field2,

     "Average Flow3Hrs";

sunny_talwar

are you may be looking for this

(("Average Flow3Hrs"/30)*0.8) + ("Average Flow3Hrs"/30) + ("Average Flow3Hrs"/30)*1.2))

as summation,

Anonymous
Not applicable
Author

Thanks Youssef

Anonymous
Not applicable
Author

Thanks sunny , I am still working on it . shall keep posted

Anonymous
Not applicable
Author

hey Sunny

Kindly see my expression it does not give me desired result .

((("Flow3 Hrs per")/(("Average Flow3Hrs"/30)*0.8))+

(("Flow3 Hrs per")/ (("Average Flow3Hrs"/30)))

+ (("Flow3 Hrs per")/(("Average Flow3Hrs"/30)*1.2))) as impactfor3

I am not able to locate impactfor3

Thanks,

Ravi

sunny_talwar

What does it give and what did you hope it would give

Anonymous
Not applicable
Author

Hello Sunny ,

please find details below

Flow3 Hrs per" has a value of 50 , 500, 400

Average Flow3Hrs has value of 154


((("50")/(("Average Flow3Hrs"/30)*0.8))+

(("500")/ (("Average Flow3Hrs"/30)))

+ (("400")/(("Average Flow3Hrs"/30)*1.2))) as impactfor3

impactfor3 should give me addition of all these 3 expression .

sunny_talwar

What is your complete script here? It seems you need some kind of Aggregation here in a resident load to calculate the Average and then left join into your main table. and then finally you will need to use a resident load to do this calculation

Anonymous
Not applicable
Author

[Project1]:

LOAD

    "Product Line",

    "Flow3 Hrs per",

    "Average Flow3Hrs",

(("Average Flow3Hrs"/30)*0.8) + ("Average Flow3Hrs"/30) + ((("Average Flow3Hrs"/30)*1.2))

as flow3summation,

(("Flow3 Hrs per")/(("Average Flow3Hrs"/30)*0.8))+(("Flow3 Hrs per")/(("Average Flow3Hrs"/30)))+(("Flow3 Hrs per")/(("Average Flow3Hrs"/30)*1.2)) as impactfor3

FROM [lib://AttachedFiles/Complexity_Mix.xlsx]

(ooxml, embedded labels, header is 1 lines, table is Model)

where "Product Line"='Terminals';

left Join ([Project1])

[Duration]:

Load

"Product Line",

"Average Flow3Hrs",

"Flow3 Hrs per", 

((("Flow3 Hrs per")/(("Average Flow3Hrs"/30)*0.8))+

(("Flow3 Hrs per")/ (("Average Flow3Hrs"/30)))

+ (("Flow3 Hrs per")/(("Average Flow3Hrs"/30)*1.2))) as impactfor3

Resident [Project1]

Group by "Product Line";