Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Jryacr
Contributor II
Contributor II

Pivot Chart sum from a single column but two different values

Hi,

newbie question.. I'm trying to setup a pivot table where each row in a column gets its own total value after subtracting from two different values in a column ( I don't know if it makes sense). Screen shot below

 
1 Solution

Accepted Solutions
Kushal_Chawda
MVP
MVP

Dim:
LOAD * Inline [
Dim
1
2 ];

 

[Key Figure] Dimension:

=pick(Dim,[Key Figure],'Total')

Expression:

=pick(Dim,Sum(Value),sum({<[Key Figure]={'Final Forecast Qty'}>}Value)-sum({<[Key Figure]={'Sales History Qty'}>}Value))

Note:

Here I have assumed your expression is Sum(Value). You can change your expression accordingly

View solution in original post

6 Replies
Kushal_Chawda
MVP
MVP

You can do it using following approach.

Create one inline table in script

Dim:
LOAD * Inline [
Dim
1
2 ];

 

Now in pivot table, Just replace the  [Key Figure] Dimension with below calculated dimension

=pick(Dim,[Key Figure] ,'Total')

Rest all dimension and expression of the pivot table will remain as is.

Jryacr
Contributor II
Contributor II
Author

This is really helpful Thanks!!!!… we are getting some where!!!!...How can I subtract instead of adding the value....screenshot attached.

 

Regards,

Kushal_Chawda
MVP
MVP

 it forecast-sales or sales-forecast ?

Jryacr
Contributor II
Contributor II
Author

Spoiler
 

 Final Forecast Qty - Sales History Qty

Kushal_Chawda
MVP
MVP

Dim:
LOAD * Inline [
Dim
1
2 ];

 

[Key Figure] Dimension:

=pick(Dim,[Key Figure],'Total')

Expression:

=pick(Dim,Sum(Value),sum({<[Key Figure]={'Final Forecast Qty'}>}Value)-sum({<[Key Figure]={'Sales History Qty'}>}Value))

Note:

Here I have assumed your expression is Sum(Value). You can change your expression accordingly

Jryacr
Contributor II
Contributor II
Author

Thank you Sir!!!! you are the best. I had to play around with "Sum(Value) it was giving me an error on the expression, but I was able to fix it...Thanks and Regards!