Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Dmoreno
Contributor
Contributor

Sum(TOTAL Column(n)) by Dimension

hola!
Quisiera pedirles apoyo con el siguiente problema:

Estoy haciendo un cálculo algo complejo, en dónde necesito sumar el total de una columna pero según vaya cambiando el nombre en otra columna.

Por ejemplo: En una nueva columna de medida necesito sumar el total de la columna(a) y dividirlo en el total de la columna(b), según vaya cambiando el nombre de la columna (c) y ese resultado que me lo muestre repitiéndolo en la cantidad de filas que tenga dicho nombre (Por ejemplo en Ram Antuco y Ritoque debiese ser apróx. 0,56 en las tres filas)

Dmoreno_0-1701188634732.png

Intenté hacerlo directamente con las fórmulas de cada columna pero son un poco complejas y no me da el resultado final.

Conocen algún método para hacer lo que necesito? probé varias opciones que vi en la comunidad pero ninguna me ha resultado 😞 

Espero se haya entendido mi problemática.

saludos!

8 Replies
MatheusC
Specialist
Specialist

@Dmoreno 

See if this helps you

sum(total<Nombre>[VP Ponderado])

/

sum(total<Nombre>VP)

Att,
Matheus

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!
Dmoreno
Contributor
Contributor
Author

It didn't work 😞

The thing is that even the function sum with a column, doesn't work

 

Dmoreno_0-1701197564143.png

 

Atte.

Dmoreno

MatheusC
Specialist
Specialist

@Dmoreno 

What is the purpose of the Column() function in this case?

The Column() function, although practical, has some limitations
https://help.qlik.com/pt-BR/qlikview/May2023/Subsystems/Client/Content/QV_QlikView/ChartFunctions/In...

For simple division, we could just use
Column(2)
/
Column(1)
--> would work great

But from what was mentioned in the topic, it is necessary that the calculation is based on the dimension, to have a total per dimension we need to represent it by the Symbols “greater than” and “less than” <Dimension>.
That's why the idea of ​​instead of using the Column() function, using the measurement within the VP and Weighted VP expression

sum(total<dimension>VP Ponderado)
/
sum(total<dimension> VP)

Att,
Matheus

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!
Dmoreno
Contributor
Contributor
Author

@MatheusC 

I did what you say but neither work.

Qlik accept me the formula but i get nothing

sum(total{<dimension>}VP Ponderado)
/
sum(total{<dimension>}VP)

Dmoreno_0-1701266063167.png

Thanks!

 

 

rubenmarin

Hola, lo que dice @MatheusC es que uses el nombre de la dimensión, y no te ha puesto ningún { ni } por eso en la primera respuesta ya había puesto:

sum(total<Nombre>[VP Ponderado])

/

sum(total<Nombre>VP)

Y tiene toda la pinta de ser la respuesta correcta.

Si la primera dimensión no es campo 'Nombre' cámbialo por el que sea.

Saludos.

 

Dmoreno
Contributor
Contributor
Author

Hola,

Probé tal cual me comentó pero me dice error en la expresión, ese error lo solucione con { } y el campo se llama Nombre.

Dmoreno_0-1701269148387.png

saludos

rubenmarin

 [VP] y [VP Ponderado] debería ser la expresión que se está usando, copiar la expresión completa que se use en la columna pero usando el "total <Nombre>" dentro de cada función de agregación.

'Total' lo que hace es ignorar todas las dimensiones, excepto las que estén entre <>

MatheusC
Specialist
Specialist

Hello, @Dmoreno 

exactly as mentioned by @rubenmarin 

I gave an example, and you need to fill it in by inserting the measurement found in the expression of these columns [VP]  and [VP Ponderado]

greetings.

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!