Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

script aggregation/accumilation


I have a calendar with all dates in the year.  In the calendar there is a flag field (1 or 0) to indicate if the day was an Invoice day.  I am trying to create a field with the count of invoice date in the month.  example Feb 2016 has no public holidays so 21 possible invoice day (Mon - Fri).  I want Monday the 1st to be 1, Tuesday the 2nd to be 2 and so on.  I think I need to combine the rangesum and peek functions to accumulate the flag and create my InvoiceDayOfMonthNumber but I cant figure out how I get it to start at 1 again on the change of a month.



3 Replies

Re: script aggregation/accumilation

Do you have a sample dataset you can share? It would be easy to guide with a sample and expected output

Re: script aggregation/accumilation

If you have a month field in your calendar and the calendar is in chronological order you can use something like:

If(MyMonthField = Previous(MyMonthField),

     rangesum(IsInvoiceDayFlag, peek(InvoiceDayOfMonthNumber)),

     IsInvoiceDay) as InvoiceDayOfMonthNumber

talk is cheap, supply exceeds demand
Not applicable

Re: script aggregation/accumilation

I had a change of tact which seems to be the way to go with some tweaking



Community Browser