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 aggregation/accumilation

Hi


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.

Thanks

Oli

3 Replies
sunny_talwar

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

Gysbert_Wassenaar

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
Author

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

Ref:

https://community.qlik.com/thread/208191