Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
SoporteSAP
Contributor
Contributor

Crear calculo de prorrateo

Buena tarde equipo Qlik.

Necesito crear el prorrateo de la utilidad bruta para poder sacar el calculo del SG&A por cliente.

El detalle es el siguiente: 

En el siguiente código intento tomar el total de mi utilidad bruta.

SoporteSAP_0-1758312961443.png

 

Para después hacer la división de mi total de utilidad bruta / utilidad bruta individual del cliente.

SoporteSAP_1-1758313060716.png

Pero algo pasa internamente que el resultado en el totalizador final es correcto, pero si hago el calculo individual por cliente me da montos distintos.

Ejemplo: Cliente1 utilidad bruta 26.368 y la utilidad total es de 8,830.575 

el resultado debería ser 0.00299 

SoporteSAP_4-1758313722377.png

y me da -0.015

SoporteSAP_2-1758313350678.png

Si tomo los datos individuales para identificar que esta haciendo, en efecto, me esta considerando una cantidad diferente en la utilidad bruta total, si le pongo un distinct en el kpi me da el monto total que debería considerar pero si no le coloco el distinct me da los 381,773.61

SoporteSAP_3-1758313683456.png

 

Espero me haya dado a entender y agradezco puedan ayudarme a identificar lo que estoy colocando de manera errónea o si hay alguna otra forma de realizarlo; cabe mencionar que el calculo debe quedar de lado del script porque ese resultado se considera en subtotales y totales en otros conceptos.

 

 

 

1 Reply
robert_mika

Look at the contact part in your script.

If you have different numbers of columns in both table it will create more rows in the final able giving your the wrong amount.

Try left join, not to join as well, look if you do not have any synthetic keys in the model.