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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Franco2
Contributor II
Contributor II

Set analysis operations

Hi!

I have a dataset that looks like this:

Sale Month Cost Benefit
1 201901 10 10
2 201901 20 20
3 201901 10 10
4 201901 20 40
5 201901 30 20
6 201902 40 20
7 201902 10 10
8 201903 20 30
9 201903 50 40
10 201903 10 10

 

And what I'm trying to get is a chart where I can see the evolution of the Benefit in a Month minus the cost of the previous month.

What I'm looking for is in this table:

Month Cost Benefit Gain
201901 90 100 100
201902 50 30 -60
201903 60 80 30

If anyone knows how to put in a chart the Gain per month I'll be really healpful.

1 Solution

Accepted Solutions
stevejoyce
Specialist II
Specialist II

sum(Cost)

sum(Benefit)

sum(Benefit) - alt(above(sum(Cost)),0)

View solution in original post

2 Replies
stevejoyce
Specialist II
Specialist II

sum(Cost)

sum(Benefit)

sum(Benefit) - alt(above(sum(Cost)),0)

Franco2
Contributor II
Contributor II
Author

Thank you soo much. It helped me. 

Only one thing. If I'd like to discount the cost not from the previous month but from two months ago, how would it be?

sum(Benefit) - alt(above(sum(Cost)),1) 

something like that