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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculated columns in pivot table

Hello,

I need your help to define a calculated expression between columns depending columns values. What I want to do it's Age0/AgeDN, Age1/AgeDN...

I have a pivot table like that :

Two dimensions : Year (2010, 2011, 2012) and AGE (DN, 0, 1, 2, 3, 4...)

One expression : SUM(VAL)

YEAR
AGEDN01
2
3
4
2010
150 00010321
2011
20 000210211
2012
140 000502101
...






What I want it's to calculate an expression which give me this result

YEARAGE
DN
0
1
2
34
2010
150 0001/150 0000/150 0003/150 000...
2011
20 0002/20 00010/20 000...

2012
140 00050/140 0002/140 000...

...














How can I do that ?

Thank you for your help.

1 Solution

Accepted Solutions
kouroshkarimi
Creator III
Creator III

=if(age='DN',sum(VAL),sum(VAL) & '/' & first(sum({<age={'DN'}>}VAL),1,0))

Edit:

Based on your example file:

=if(TEV_AGE='DN',sum(TEV_VAL),sum(TEV_VAL) & '/' & first(sum({<TEV_AGE={'DN'}>}TEV_VAL),2,0))

View solution in original post

3 Replies
Sokkorn
Master
Master

Hi kiks51,

Can you share your app with sample data?

Regards,

Sokkorn

kouroshkarimi
Creator III
Creator III

=if(age='DN',sum(VAL),sum(VAL) & '/' & first(sum({<age={'DN'}>}VAL),1,0))

Edit:

Based on your example file:

=if(TEV_AGE='DN',sum(TEV_VAL),sum(TEV_VAL) & '/' & first(sum({<TEV_AGE={'DN'}>}TEV_VAL),2,0))

Not applicable
Author

Thank you for your answer ! It works well. I've changed a little the expression because I wanted to evaluated the division. I didn't clearly express.

But now I have an other problem, it's how represent the same thing in a graph, how can I do that ?