Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
marygrace
Contributor III
Contributor III

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
sunny_talwar

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))

View solution in original post

4 Replies
sunny_talwar

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

marygrace
Contributor III
Contributor III
Author

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
sunny_talwar

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
Contributor III
Contributor III
Author

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!