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: 
pgalvezt
Specialist
Specialist

expression filter problem

Hello,

I attached a test where I have total sales by brand.

If you look at to the ASTORE Brand you'll see an amount by 4.584.617 and Margin% by 53,27%

but the real total it would be 3.588.896 and margin % by 40,31% (Filter by ASTORE)

I' ve been trying to change the factura field with articulo_marca (brand) but doesn't work.

I think my formula for this view is incorrect.

Thanks!

1 Solution

Accepted Solutions
sebastiandperei
Specialist
Specialist

Cambiá "if (codmoneda <> 'clp'...."  por  "if (codmoneda = 'clp'...."

Sorry, me confundí.

Igual, insisto, estos harcodeos es mucho mejor hacerlos en el script. Si tuvieras que modificarlos, vas a tener que actualizar todos los gráficos...

View solution in original post

11 Replies
pgalvezt
Specialist
Specialist
Author

Any Help?

Thanks!

gmoraleswit
Partner - Creator II
Partner - Creator II

Hi Pablo,

Please see attach, I calculate the sales on the script, you should do something similar for the % margin

Hope this helps

ecolomer
Master II
Master II

see this

pgalvezt
Specialist
Specialist
Author

Thanks both, but I can see that the general total is not the similar to the first total. For January =392.001.173 Total Margin 32.87%.

I did before that I can obtain the same result but the total was the problem. Just like now.

Gabriela = General January Total 392.054.426

Enrique = General January Total 391.947.920

The real total has to be : 392.001.173

sebastiandperei
Specialist
Specialist

Mirá el adjunto y hacé lo mismo para la expresión de margen:

Reducí la expresión a una más simple que no use Aggr de Aggr (fijate que por un lado, si moneda ='clp' siempre suma monto_actual, si no, suma monto_dolar_actual, y por otro lado, si son tales facturas, les agregás tal monto)

Nota: El total da diferente porque este está bien. Fijate que lo cambié a tabla simple, y en totales lo cambié por suma de filas. Da el mismo total la primer columna, por lo tanto, estás sumando valores incorrectos (por ejemplo, ASTORE está sumando 4.584.617 en lugar de 3.588.896).

Consejo: esos Hardcodeos (por ejemplo, agregarle esos totales a las facturas FX000111 y FX000112) te conviene hacerlos en el script, porque después la aplicación se te hace inmantenible.

pgalvezt
Specialist
Specialist
Author

Hola Sebastián,

Efectivamente los totales por marca dan diferentes (Erróneos) porque el filtro no lo está tomando en cuenta. Si miras el general Astore, daba distinto que cuando filtrabas por Astore, debido a que Qlikview con mi fórmula aggr por marca no me daba el resultado esperado, al no filtrar me estaba sumando otras marcas. Ahora bien tu fórmula me da bien pero sigo teniendo problemas con el total. debido a que no te suma la factura que hace el total de 392.001.173. Hice una replica de tu tabla pero por factura y no me está tomando en cuenta los $ 53.253.



sebastiandperei
Specialist
Specialist

Cambiá "if (codmoneda <> 'clp'...."  por  "if (codmoneda = 'clp'...."

Sorry, me confundí.

Igual, insisto, estos harcodeos es mucho mejor hacerlos en el script. Si tuvieras que modificarlos, vas a tener que actualizar todos los gráficos...

pgalvezt
Specialist
Specialist
Author

Hola Sebastián,

Sorry por no responder antes, no te preocupes ya lo había cambiado. creo que estamos ok. Solo una cosa más. me puedes ayudar con el % margen total, los % por empresas me dan bien solo es el resultado final que muestra.

muestra un 32,88% y debiera mostrar un 32,87% este 0,01 de diferencia es importante porque las demás vistas dan los 32,87% además de que si exportas a excel y haces el cálculo de margen de ventas dan los 32,87%.

Gracias por tu ayuda!

pgalvezt
Specialist
Specialist
Author

El problema era el márgen y no el %. Ya lo solucioné.

Gracias Sebastián por la ayuda.