Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
inigoelv
Contributor

SUM VARIABLES IN VARIABLE OVERVIEW

Hi everybody:

I am trying to do a sum of variables in variable overview and only calculate the first one:

The variables are:

vManoObraDirecta=Sum({<[TASAS HORARIAS]={"Mano obra directa:"}>} [€/hora activa de trabajo])/$(vProductividadProduccion)

vManoObraIndirectaResto= Sum({<[TASAS HORARIAS]={"Mano obra indirecta (resto):"}>} [€/hora activa de trabajo])/$(vProductividadProduccion)

If I insert them in individuals columns like  (=$(vManoObraDirecta)) it works well.

But the problem is when I try to do a sum of the two variables in the variable overview:

$(vManoObraDirecta)+$(vManoObraIndirectaResto)

only calculate the first of them: $(vManoObraDirecta).

If I change the position: $(vManoObraIndirectaResto)+$(vManoObraDirecta) calculate the other but doesn´t sum the second.

Example.JPG

Any idea?

Thanks in advance

9 Replies
qlikmsg4u
Valued Contributor

Re: SUM VARIABLES IN VARIABLE OVERVIEW

may be you are missing to Put "=" sign before $(vManoObraIndirectaResto)+$(vManoObraDirecta)

like vVariable3 = (=$(vManoObraIndirectaResto)+$(vManoObraDirecta))


Untitled.png

MVP
MVP

Re: SUM VARIABLES IN VARIABLE OVERVIEW

I am not sure of the definition of vProductividadProduccion, but I would add these two like this:

     =RangeSum(($(vManoObraDirecta)), ($(vManoObraIndirectaResto)))

RangeSum handles the case where one of the expressions is null.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
inigoelv
Contributor

Re: SUM VARIABLES IN VARIABLE OVERVIEW

Hi Jonathan:

The two solutions doesn´t work.

The formul of the productivity is a very long expression:

if([Nº of plies (nº)]=2,if(([Metros /Min]/(Avg([Sheet lenght (mm)])*Avg([Nº of sheets (nº)])/1000))>[Barras / Min],

[Barras / Min]*(Floor(2750/Avg([Width sheet  (mm)])))*0.7*60, [Metros /Min]/(Avg([Sheet lenght (mm)])*Avg([Nº of sheets (nº)])/1000)*(Floor(2750/Avg([Width sheet  (mm)])))*0.7*60),if(([Metros /Min]/(Avg([Sheet lenght (mm)])*Avg([Nº of sheets (nº)])/1000))>[Barras / Min], [Barras / Min]*(Floor(2750/Avg([Width sheet  (mm)])))*0.7*60*7/8, [Metros /Min]/(Avg([Sheet lenght (mm)])*Avg([Nº of sheets (nº)])/1000)*(Floor(2750/Avg([Width sheet  (mm)])))*0.7*60*7/8))

                                                                                              

It is very strange that only the first variable is well calculated.

sasiparupudi1
Honored Contributor III

Re: SUM VARIABLES IN VARIABLE OVERVIEW

did try wrapping the variable in num#($(vManoObraDirecta),'#,##0.# ')?

MVP
MVP

Re: SUM VARIABLES IN VARIABLE OVERVIEW

Change the double quotes into single quotes, and/or try this:

Sum({<[TASAS HORARIAS]={'Mano obra directa:', 'Mano obra indirecta (resto):'}>} [€/hora activa de trabajo])/ ($(vProductividadProduccion))

If that works, and you want it in a variable, then you can create a single variable.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
inigoelv
Contributor

Re: SUM VARIABLES IN VARIABLE OVERVIEW

Hi Jonathan:

At the end this option is correct but I would have prefer to make work the expression like sum of variables.

Anyway, thank you.

sasiparupudi1
Honored Contributor III

Re: SUM VARIABLES IN VARIABLE OVERVIEW

You could may be try

vManoObraDirecta=Sum({<[TASAS HORARIAS]={"Mano obra directa:"}>} [€/hora activa de trabajo])

vManoObraIndirectaResto= Sum({<[TASAS HORARIAS]={"Mano obra indirecta (resto):"}>} [€/hora activa de trabajo])

($(vManoObraDirecta)+$(vManoObraIndirectaResto))/$(vProductividadProduccion)

MVP
MVP

Re: SUM VARIABLES IN VARIABLE OVERVIEW

You are not using comments (//) in your variable definitions, right?

inigoelv
Contributor

Re: SUM VARIABLES IN VARIABLE OVERVIEW

Hi Sasidhar:

Really, this is the correct solution.

It works well.

Thank you.

Community Browser