Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

script help

Hi,

I have two field i.e. - Invoice Date and Amount, I want this

    

Invoice DateAmountOutput -->Invoice DateAmount
01/01/2015131/01/2015301
02/01/20151128/02/2015581
03/01/20152131/03/2015891
04/01/20153130/04/20151191
05/01/20154101/05/20151201
06/01/20155102/05/20151211
07/01/20156103/05/20151221
08/01/20157104/05/20151231
09/01/20158105/05/20151241
10/01/20159106/05/20151251
11/01/201510107/05/20151261
12/01/201511108/05/20151271
13/01/201512109/05/20151281
14/01/201513110/05/20151291
15/01/201514111/05/20151301
16/01/201515112/05/20151311
17/01/201516113/05/20151321
18/01/201517114/05/20151331
19/01/201518115/05/20151341
20/01/2015191
21/01/2015201
22/01/2015211
23/01/2015221
24/01/2015231
25/01/2015241
26/01/2015251
27/01/2015261
28/01/2015271
29/01/2015281
30/01/2015291
31/01/2015301
01/02/2015311
02/02/2015321
03/02/2015331
04/02/2015341
05/02/2015351
06/02/2015361
07/02/2015371
08/02/2015381
09/02/2015391
10/02/2015401
11/02/2015411
12/02/2015421
13/02/2015431
14/02/2015441
15/02/2015451
16/02/2015461
17/02/2015471
18/02/2015481
19/02/2015491
20/02/2015501
21/02/2015511
22/02/2015521
23/02/2015531
24/02/2015541
25/02/2015551
26/02/2015561
27/02/2015571
28/02/2015581
01/03/2015591
02/03/2015601
03/03/2015611
04/03/2015621
05/03/2015631
06/03/2015641
07/03/2015651
08/03/2015661
09/03/2015671
10/03/2015681
11/03/2015691
12/03/2015701
13/03/2015711
14/03/2015721
15/03/2015731
16/03/2015741
17/03/2015751
18/03/2015761
19/03/2015771
20/03/2015781
21/03/2015791
22/03/2015801
23/03/2015811
24/03/2015821
25/03/2015831
26/03/2015841
27/03/2015851
28/03/2015861
29/03/2015871
30/03/2015881
31/03/2015891
01/04/2015901
02/04/2015911
03/04/2015921
04/04/2015931
05/04/2015941
06/04/2015951
07/04/2015961
08/04/2015971
09/04/2015981
10/04/2015991
11/04/20151001
12/04/20151011
13/04/20151021
14/04/20151031
15/04/20151041
16/04/20151051
17/04/20151061
18/04/20151071
19/04/20151081
20/04/20151091
21/04/20151101
22/04/20151111
23/04/20151121
24/04/20151131
25/04/20151141
26/04/20151151
27/04/20151161
28/04/20151171
29/04/20151181
30/04/20151191
01/05/20151201
02/05/20151211
03/05/20151221
04/05/20151231
05/05/20151241
06/05/20151251
07/05/20151261
08/05/20151271
09/05/20151281
10/05/20151291
11/05/20151301
12/05/20151311
13/05/20151321
14/05/20151331
15/05/20151341

  

24 Replies
petter
Partner - Champion III
Partner - Champion III

Ok ... then this should be a script solution that also caters for a single first month Amount

sona_sa
Creator II
Creator II

Hi Peter,

Please find the attached qvw. Now 1st June 2015 should not to come in the same scenario. Here 1st is coming.

Also can we do it by using any variable or nested if or by for loop.

Thanks for reply.

Gysbert_Wassenaar

I don't understand why you reposted my example and restated your requirements that as I understand them are already implemented in the example.

Please find the attached qvw. In the same scenerio if 1st June is coming it is stoping and returning me for Jan to May monthend date.

Yes, that's what you asked for and that's what my example shows you. And the qvw file you posted shows you exactly this.

comm164202.png

But output will be - From Jan to Apr - Monthend date of jan / feb / march / apr and for may month from 1st to 31st date will come and for June no date will come. But suppose 2nd june or so on date is coming,

That's why my example does and what the attachment you posted above does too.

From Jan to May - monthend date but for June till date data will be available.

Of course not, because that's what you asked for.

Can you explain where I'm misunderstanding your requirements?


talk is cheap, supply exceeds demand
sona_sa
Creator II
Creator II

Yes Sure Gysbert,

If date is available till 1st of any month from Jan to Dec. 01-Month-Year will not display and for previous month It will give entire month date and prior to prior month it will return only monthend date. But suppose if 2 or 3 or so on is available then it will return previous month --> Monthend Date and for current month till date.

Below are my Input and Output.

       

Input Invoice DateOutput -->Onput Invoice Date Input Invoice DateOutput -->Onput Invoice Date
1/1/20151/31/20151/1/20151/31/2015
1/2/20152/28/20151/2/20152/28/2015
1/3/20153/31/20151/3/20153/31/2015
1/4/20154/1/20151/4/20154/30/2015
1/5/20154/2/20151/5/20155/1/2015
1/6/20154/3/20151/6/20155/2/2015
1/7/20154/4/20151/7/20155/3/2015
1/8/20154/5/20151/8/2015
1/9/20154/6/20151/9/2015
1/10/20154/7/20151/10/2015
1/11/20154/8/20151/11/2015
1/12/20154/9/20151/12/2015
1/13/20154/10/20151/13/2015
1/14/20154/11/20151/14/2015
1/15/20154/12/20151/15/2015
1/16/20154/13/20151/16/2015
1/17/20154/14/20151/17/2015
1/18/20154/15/20151/18/2015
1/19/20154/16/20151/19/2015
1/20/20154/17/20151/20/2015
1/21/20154/18/20151/21/2015
1/22/20154/19/20151/22/2015
1/23/20154/20/20151/23/2015
1/24/20154/21/20151/24/2015
1/25/20154/22/20151/25/2015
1/26/20154/23/20151/26/2015
1/27/20154/24/20151/27/2015
1/28/20154/25/20151/28/2015
1/29/20154/26/20151/29/2015
1/30/20154/27/20151/30/2015
1/31/20154/28/20151/31/2015
2/1/20154/29/20152/1/2015
2/2/20154/30/20152/2/2015
2/3/20152/3/2015
2/4/20152/4/2015
2/5/20152/5/2015
2/6/20152/6/2015
2/7/20152/7/2015
2/8/20152/8/2015
2/9/20152/9/2015
2/10/20152/10/2015
2/11/20152/11/2015
2/12/20152/12/2015
2/13/20152/13/2015
2/14/20152/14/2015
2/15/20152/15/2015
2/16/20152/16/2015
2/17/20152/17/2015
2/18/20152/18/2015
2/19/20152/19/2015
2/20/20152/20/2015
2/21/20152/21/2015
2/22/20152/22/2015
2/23/20152/23/2015
2/24/20152/24/2015
2/25/20152/25/2015
2/26/20152/26/2015
2/27/20152/27/2015
2/28/20152/28/2015
3/1/20153/1/2015
3/2/20153/2/2015
3/3/20153/3/2015
3/4/20153/4/2015
3/5/20153/5/2015
3/6/20153/6/2015
3/7/20153/7/2015
3/8/20153/8/2015
3/9/20153/9/2015
3/10/20153/10/2015
3/11/20153/11/2015
3/12/20153/12/2015
3/13/20153/13/2015
3/14/20153/14/2015
3/15/20153/15/2015
3/16/20153/16/2015
3/17/20153/17/2015
3/18/20153/18/2015
3/19/20153/19/2015
3/20/20153/20/2015
3/21/20153/21/2015
3/22/20153/22/2015
3/23/20153/23/2015
3/24/20153/24/2015
3/25/20153/25/2015
3/26/20153/26/2015
3/27/20153/27/2015
3/28/20153/28/2015
3/29/20153/29/2015
3/30/20153/30/2015
3/31/20153/31/2015
4/1/20154/1/2015
4/2/20154/2/2015
4/3/20154/3/2015
4/4/20154/4/2015
4/5/20154/5/2015
4/6/20154/6/2015
4/7/20154/7/2015
4/8/20154/8/2015
4/9/20154/9/2015
4/10/20154/10/2015
4/11/20154/11/2015
4/12/20154/12/2015
4/13/20154/13/2015
4/14/20154/14/2015
4/15/20154/15/2015
4/16/20154/16/2015
4/17/20154/17/2015
4/18/20154/18/2015
4/19/20154/19/2015
4/20/20154/20/2015
4/21/20154/21/2015
4/22/20154/22/2015
4/23/20154/23/2015
4/24/20154/24/2015
4/25/20154/25/2015
4/26/20154/26/2015
4/27/20154/27/2015
4/28/20154/28/2015
4/29/20154/29/2015
4/30/20154/30/2015
5/1/20155/1/2015
5/2/2015
5/3/2015
Gysbert_Wassenaar

If date is available till 1st of any month from Jan to Dec. 01-Month-Year will not display

What do you mean '01-Month-Year will not display? What does that mean?


and for previous month It will give entire month date

What do you mean 'give entire month date'? What is a 'month date'? And what is the difference between an entire one and a partial one?


and prior to prior month it will return only monthend date.

Prior to prior month? Does that mean not the previous month, but the month before that?


But suppose if 2 or 3 or so on is available then it will return previous month --> Monthend Date and for current month till date.

And how is this different from the implementations that we already posted? Please show me how the example output you posted above is different from the results in the examples and screenshots I posted.


talk is cheap, supply exceeds demand
sona_sa
Creator II
Creator II

Hi Gysbert,

Please find the attached xls, I have mention with example in both scenario, But output should to return. I can understand that I am not explaining verbally, But by xls. hope you are able to understand the same.

Thanks.

preminqlik
Specialist II
Specialist II

hi there ,

u need to create set expression values wrt it like below

sum({<Month=,InvoiceDate={$(=Concat({<Year={$(=max(Year))},Month={"<$(=max(Month))"}>} distinct chr(39)&Date(num(floor(MonthEnd(InvoiceDate))),'DD/MM/YYYY')&chr(39),','))}+

{$(=Concat(distinct aggr(nodistinct only({<Year={$(=max(Year))},Month={$(=maxstring(Month))}>}chr(39)&Date(InvoiceDate,'DD/MM/YYYY')&Chr(39)),InvoiceDate),','))}

>}Amount)

find the attaachment, Hope this helps you

petter
Partner - Champion III
Partner - Champion III

Are you seriously trying to solve it yourself? It seems to me that you are only testing everything that people are suggesting to you without doing any contribution except testing and feedback. I don't consider this the right way of using this forum. Make a serious effort to make it work - with at least a minor effort to get it to work and then come back to us.

Gysbert_Wassenaar

I'm sorry, but I give up. Your excel file shows exactly the kind of output my example does. You can't explain why my solution does not meet your requirements. Good luck.


talk is cheap, supply exceeds demand
sona_sa
Creator II
Creator II

Here in Input Invoice Date Date is till 1st May 2015 - OutPut is for Apr Month Entire date is available and prior month (Jan / Feb / Mar) -- Monthend Date is coming.

In Fig. 2 --> In Input Invoice Date after 1st May there is Date available for 2nd or 3rd, So Output is for previous month is Monthend Date but for current month entire 3 date is available.

Means whenever if new month come or first day of month is available for current month the it will return Output 1 else output 2.

If maxdate is 1 then return me previous month entire date else return me till date and for previous month - monthend date.

Hope you got my point.