- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Calculate cash amount for each month
Hi,
I have a problem in calculating cash amount for each month.
My table look like
Month Cost Income
2017-01 1000 10.000
2017-02 500 should be 10.000-(1000+500) = 8500
....
....
I couldnt succeed in calculating net "Income" column .
I would appreciate for helps.
Thanks
- Tags:
- qlikview_scripting
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try this using peek() at script level:
The cumulative column is named as GrossIncome.
Refer qvw attached as reference.
Thanks and regards,
Arthur Fong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The way I look at your logic your income will be decreasing throughout all the months.
Unless you have Cost in negative amount.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Exactly yes. In line chart it will descrease through months.
In load script ; If ı succeeded in calculating cumulative cost , I would achieve
net profit by income - cumulative cost
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try this using peek() at script level:
The cumulative column is named as GrossIncome.
Refer qvw attached as reference.
Thanks and regards,
Arthur Fong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your reply. But I think GrossIncome column's last row should be '7500' instead of 6500. 7500 net income based on this data set
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Isnt it taking 7500 - [500(current cost) +500(previous cost)]=6500?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just changed slightly your script.
thanks for your help
if(rowno()=1, Income - Cost, peek(GrossIncome2)-(Cost))as GrossIncome2