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: 
stantrolav
Partner - Creator II
Partner - Creator II

How to count that?

How can i count [Amount for date]:

AgreementDateAmountAmount for date
130225.01.201333999,07167897,57
130231.01.2013-420,93133898,5
130226.02.201333835,26134319,43
130228.02.2013-105,19100484,17
130225.03.201333574,91100589,36
130231.03.2013-210,6767014,45
130225.04.201333700,5867225,12
130230.04.2013-87,833524,54
130227.05.201333612,3433612,34
130326.02.201356769,77113209,12
130328.02.2013-55,356439,35
130325.03.201356494,6556494,65
130441269115212,56460674,63
130430.01.2013-174,66460674,63
130431.01.2013115249,02345462,07
130428.02.2013115157,08345636,73
130429.03.2013-116,55230387,71
130431.03.2013115347,18115230,63

Here examples with logic:

Amount For Date in 1302 agreement for 28.02.2013 equals sum of all amounts except amounts of days before.

1 Solution

Accepted Solutions
stantrolav
Partner - Creator II
Partner - Creator II
Author

How to count amount for date?

http://community.qlik.com/servlet/JiveServlet/download/438206-84520/comm102179.qvw

This is the answer. Thanks for cooperation.

First of all we load 3 colums from my table into table INPUT . Next:


RESULT:

LOAD

  Agreement as Agreement_1,

  Date,

  Amount,

  if(peek(Agreement_1)<>Agreement, Amount, rangesum(peek([Amount for Date]),Amount)) as [Amount for Date]

Resident INPUT order by Agreement, Date desc;

View solution in original post

7 Replies
stantrolav
Partner - Creator II
Partner - Creator II
Author

Also this column may be loaded in load script. But how can I make that?

Anonymous
Not applicable

make your question more clear like

your statement

Amount For Date in 1302 agreement for 28.02.2013 equals sum of all amounts except amounts of days before.

please write or explain in diffrentt way

Regards,

anant

stantrolav
Partner - Creator II
Partner - Creator II
Author

Amount for date

is the field that i want to express.

stantrolav
Partner - Creator II
Partner - Creator II
Author

=SUM(C5:C10)

ljackson
Creator
Creator

I think I understand what Stanislav is asking, but don't know how to write the expression requested.

The way I read it, he wants to know what the expression should be to show the 'Amount for Date' column, based on the following:  Take the balance from the previous day, minus the 'Amount' for the previous day (a running balance excluding the current date)

So, taking 25.03.2013 as an example, the previous 'Amount for Date' is 100,484.17, if you minus the -105.19 you’ll get a new ‘Amount for Date’ as 100,589.36.   The next entry (31.03.2013)  is 100,589.36 minus 33,574.91 = 67,014.45.

Is this what you need Stanlislav?

.

tresesco
MVP
MVP

May be like attached sample?

Input:

Load * Inline [
Agreement,Date,Amount, "Amount for date"
1302,25.01.2013,3399907,16789757
1302,31.01.2013,-42093,1338985
1302,26.02.2013,3383526,13431943
1302,28.02.2013,-10519,10048417
1302,25.03.2013,3357491,10058936
1302,31.03.2013,-21067,6701445
1302,25.04.2013,3370058,6722512
1302,30.04.2013,-878,3352454
1302,27.05.2013,3361234,3361234
1303,26.02.2013,5676977,11320912
1303,28.02.2013,-553,5643935
1303,25.03.2013,5649465,5649465
1304,41269,11521256,46067463
1304,30.01.2013,-17466,46067463
1304,31.01.2013,11524902,34546207
1304,28.02.2013,11515708,34563673
1304,29.03.2013,-11655,23038771
1304,31.03.2013,11534718,11523063

];
outer join
Load
Agreement,
Date as NewDate
Resident Input;

Output:
Load Agreement, Date, Amount, "Amount for date",
Count(If(NewDate>=Date,Amount)) as CountF
Resident Input Group By Agreement, Date, Amount, "Amount for date";

Drop Table Input;

stantrolav
Partner - Creator II
Partner - Creator II
Author

How to count amount for date?

http://community.qlik.com/servlet/JiveServlet/download/438206-84520/comm102179.qvw

This is the answer. Thanks for cooperation.

First of all we load 3 colums from my table into table INPUT . Next:


RESULT:

LOAD

  Agreement as Agreement_1,

  Date,

  Amount,

  if(peek(Agreement_1)<>Agreement, Amount, rangesum(peek([Amount for Date]),Amount)) as [Amount for Date]

Resident INPUT order by Agreement, Date desc;