Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

sum of columns instead of sum of rows

Sorry, I can't explain better. I have a table like this:
-------------------- Sales ---------------------

Sales DE | 100 | 110 |

Sales UK | 80 | 40 |

Sales IT | 200 | 220 |

Total | 380 | 270 |


I'd like to have a table like this

-------------------- Sales ---------------------

Sales DE 210 | 100 | 110 |

Sales UK 120 | 80 | 40 |

Sales IT 420 | 200 | 220 |


anyone can help me? Thanks

21 Replies
Not applicable
Author

If you have 24 expressions, then yes, you could make a Total column that was the sum of the previous 24 expressions.

I have to believe, however, that there is an easier way to approach this problem. Unfortulately it is difficult to do without seeing the code.

Any possibility you could attach a QVW?

Not applicable
Author

How can I attach the Qvw? The control panel allow me to insert only media contents..

Do I have to use the "Share QlikViews" utility?

Not applicable
Author

I can directly send you the qvw using your personal e-mail, just tell me.

Not applicable
Author

When you hit on the Reply, go to the option panel and then use Add/Update on the file attachment.

Not applicable
Author

Done

johnw
Champion III
Champion III

OK, so you want totals in a pivot table. A relatively simple approach would be to add a ='Total' calculated dimension, go with indent mode on the style tab, and the swap your horizontal and vertical dimensions. On the down side, you have to swap your horizontal and vertical dimensions, so it doesn't look very good.

johnw
Champion III
Champion III

Aother approach is to add a value of 'Total' to the list of field values, then check for it and change the expression to match what you want in the chart. This seems more complicated than it should be, but keeps you from having to swap the horizontal and vertical dimensions. I'm hoping someone has a better solution than either of mine.

Not applicable
Author

Ok, thank you, but as you can see I cannot swap the Horizontal dimension to Vertical... I don't know why

Not applicable
Author

Maybe this solution can work, I'll try but I already know that there is a big problem: if I write

sum(f( Tag_Stato='ACC',if(GetFieldSelections(Tag_UDM,'')='MWh',...BID',-1,1 ))),0 )

there is an 'Error in Expression'. Why? Is the expression wrong to be used in a sum expression?

Not applicable
Author

Hmm.. Pivot table seemed to be the simplest solution. Dragging the column header to the right should put the vertical to horizontal header. There is no need to get into complex aggregations etc, if a simple pivot could give you the totals.