Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculated Rows in a Pivot Table

Hello QV Community;

Need some help, appreciate your feedback.

In attached sample table(just a sample table, in actual there are millions of records)I have a pivot table that looks likes this:
Current Table

currenttable.gif

but would like to have a modified table as below (by adding Gross Margin & Operating Margin rows):

modifiedtable.gif


1 Solution

Accepted Solutions
petter
Partner - Champion III
Partner - Champion III

Here is a rather crude way of solving it for your specific purpose:

2015-09-20 #3.png

View solution in original post

8 Replies
marcus_sommer

I suggest you creates those rows additionally within the script (you could simple add this rows per concatenate to the original table from a small inline-table) and adds another field which containes 1 for positive values and -1 for negative values and then you could use something like this:

if(Class = 'Gross Margin', sum({ < Class = {'Sales', 'Cos'}>} Value * PosNegFlag), sum(Value))

- Marcus

Not applicable
Author

Hello Marcus:

Thanks for your response and for your time much appreciated, I applied your suggestion to the model and

was not able to get it to work, would it be possible for you to look at it and kindly let me know where I am wrong

thanks once again,

(I have attached the model with the suggested modification for your review)

petter
Partner - Champion III
Partner - Champion III

Here is a rather crude way of solving it for your specific purpose:

2015-09-20 #3.png

Not applicable
Author

Modify your expression:

Margins.PNG

marcus_sommer

Have a look on the solution from petter-s - I like it.

- Marcus

Not applicable
Author

Thanks Peter, appreciate for the solution

Not applicable
Author

Thanks Changuk Bak.

Gonziandre
Contributor
Contributor

How can I see the code you used to develop this presentation? Thanks