Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Pivot Table Partial Percentage

Hello

I´ve been looking for this answer into the community and there are some similar topics but there are not a complete answer at all.

In addition of the partial sum, I need to show the % of the total sum

Pivot Table %.JPG

Ingresos, Costos, Gastos and Utilidad are expressions as a result of a algebraic operation from my database. As you can see, INGRESOS is the base to calculate all the others (COSTOS, GASTOS and UTILIDAD)

I will appreciate your help

16 Replies
Anonymous
Not applicable
Author

Excuse me.

Can´t see how to attach a file. I see icons to attach an image, videos and links

Anonymous
Not applicable
Author

Uf!! It is really a trick

Thanks a  lot again.

I have a personal edition, so I could not open a .qvw from others

sunny_talwar

Is this what you want?

Capture.PNG

I will try to go step by step, but let me know if you still are not clear about something

1) Add an inline load at the end of your script.

Dim:

LOAD * Inline [

Dim

1

2

3

];

Capture.PNG

Modify your chart like this

Dimensions

Dim 1 change from Mes to

=Pick(Dim, MES, 'Total', 'Percent')

Dim 2 change from Clase to

=Pick(Dim, Clase, Dual(' ', 1), Dual(' ', 2))

Capture.PNG

Expressions changed to theses

1) Pick(Dim,

Num(Sum({<Descrip_Nivel_1 = {'INGRESOS'}>} Valor), '$ #.##0'),

Num(Sum({<Descrip_Nivel_1 = {'INGRESOS'}>} Valor), '$ #.##0'),

Num(1, '##,0%'))

2) Pick(Dim,

Num(Sum({<Descrip_Nivel_1 = {'COSTOS DE PRODUCCION O DE OPERACION'}>} Valor), '$ #.##0'),

Num(Sum({<Descrip_Nivel_1 = {'COSTOS DE PRODUCCION O DE OPERACION'}>} Valor), '$ #.##0'),

Num(Sum({<Descrip_Nivel_1 = {'COSTOS DE PRODUCCION O DE OPERACION'}>} Valor)/Sum({<Descrip_Nivel_1 = {'INGRESOS'}>} Valor), '##,0%'))

3) Pick(Dim,

Num(Sum({<Descrip_Nivel_1 = {'GASTOS'}>} Valor), '$ #.##0'),

Num(Sum({<Descrip_Nivel_1 = {'GASTOS'}>} Valor), '$ #.##0'),

Num(Sum({<Descrip_Nivel_1 = {'GASTOS'}>} Valor)/Sum({<Descrip_Nivel_1 = {'INGRESOS'}>} Valor), '##,0%'))

4) Pick(Dim,

Num(INGRESOS+COSTOS+GASTOS, '$ #.##0'),

Num(INGRESOS+COSTOS+GASTOS, '$ #.##0'),

Num(INGRESOS+COSTOS+GASTOS/Sum({<Descrip_Nivel_1 = {'INGRESOS'}>} Valor), '##,0%'))

Some other changes

1) Uncheck partial sum for Mes dimension

2) Added a color formatting for background color for the 2 dimensions and all the 4 expressions

Capture.PNG

Expression used for color

=If(Match(Dim, 2, 3), RGB(192,192,192))

Expression used for Format

=If(Match(Dim, 2, 3), '<B>')

Once you do all the above, you should almost reach what I have posted above. Let me know if you still have issues. Also, I know you are working with personal addition of QlikView, I will still attach the sample as it may help somebody else in the future.

Best,

Sunny

Anonymous
Not applicable
Author

Great!! Thank you so much Sunny T

The 4th expression is not working. Maybe it is missing a quotation mark, function  or something like that.

Anonymous
Not applicable
Author

Now all the expressions are working Ok. I added a 4th Dim in the script:

Dim:

LOAD * Inline [

Dim

1

2

3

4

];


Best regards

sunny_talwar

Not sure why you need 4th Dim.