Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

marygrace
New Contributor II

Calculation each Line of Order and Sum the total

Hello,

   I need to calculate the total Boxes; the calculation is by each LineNumber (Quantity / CapacityBox)  then Sum the result for each line . I did with the next variable, but my result looks different, I insert into the table the calculation is by LineNumber, however I need to have the total calculation into variable.

Sum({<Numero_Linea={*}, [PROYECTO ESPECIAL]={'N'}, Año={$(vAñoActual)}, _Id_Flag={0}, Estatus_Cobranza= {'EN SURTIDO','FACTURADO','ENTREGADO','CONSOLIDADO'}, TipoDeEntrega -= {'SOLO FACTURA'} >}Cantidad)

/

Sum({<Numero_Linea={*}, [PROYECTO ESPECIAL]={'N'}, Año={$(vAñoActual)}, _Id_Flag={0}, Estatus_Cobranza= {'EN SURTIDO','FACTURADO','ENTREGADO','CONSOLIDADO'}, TipoDeEntrega -= {'SOLO FACTURA'} >}Cant_PzasxCajas)


Sum the Total for Each Line Estimated = Quantity / CapacityBox

 

Table&amp;KPI.JPG

Somebody can help me?

Thank you!

1 Solution

Accepted Solutions
MVP
MVP

Re: Calculation each Line of Order and Sum the total

Try this

Sum(Aggr(

Sum({<Numero_Linea={*}, [PROYECTO ESPECIAL]={'N'}, Año={$(vAñoActual)}, _Id_Flag={0}, Estatus_Cobranza= {'EN SURTIDO','FACTURADO','ENTREGADO','CONSOLIDADO'}, TipoDeEntrega -= {'SOLO FACTURA'} >}Cantidad)

/

Sum({<Numero_Linea={*}, [PROYECTO ESPECIAL]={'N'}, Año={$(vAñoActual)}, _Id_Flag={0}, Estatus_Cobranza= {'EN SURTIDO','FACTURADO','ENTREGADO','CONSOLIDADO'}, TipoDeEntrega -= {'SOLO FACTURA'} >}Cant_PzasxCajas)

, DayDelivery, DayOrder, OrderNumber, LineNumber, ItemCode))

4 Replies
MVP
MVP

Re: Calculation each Line of Order and Sum the total

Not sure I understand what you are looking to do? What is the black box in the image suppose to show?

marygrace
New Contributor II

Re: Calculation each Line of Order and Sum the total

For example:

Order Number: 90002419 has 4 lines 0,1,2 and 3 each line has Quantity / Capacity Box, the calculation is good into the table= Box Estimated  but in the total is not good the result  also the variable is not correct because is taking the total of quantity and total capacity. I want to Sum each line = Box Estimated column.

Table&amp;KPI_02.JPG

Goo result should be like this

  

Box Estimated
0.200
0.100
0.250
0.500
Total Sum    1.050
MVP
MVP

Re: Calculation each Line of Order and Sum the total

Try this

Sum(Aggr(

Sum({<Numero_Linea={*}, [PROYECTO ESPECIAL]={'N'}, Año={$(vAñoActual)}, _Id_Flag={0}, Estatus_Cobranza= {'EN SURTIDO','FACTURADO','ENTREGADO','CONSOLIDADO'}, TipoDeEntrega -= {'SOLO FACTURA'} >}Cantidad)

/

Sum({<Numero_Linea={*}, [PROYECTO ESPECIAL]={'N'}, Año={$(vAñoActual)}, _Id_Flag={0}, Estatus_Cobranza= {'EN SURTIDO','FACTURADO','ENTREGADO','CONSOLIDADO'}, TipoDeEntrega -= {'SOLO FACTURA'} >}Cant_PzasxCajas)

, DayDelivery, DayOrder, OrderNumber, LineNumber, ItemCode))

marygrace
New Contributor II

Re: Calculation each Line of Order and Sum the total

Works!!!

I am new in Qliksense, it is my first project and I have very nice experience in the community.
Thank you So much Sunny Talwar!