Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Make an MonthCounter

Hello,

in my calendar do I have an 'InvoicePeriodCounter' and every month has two invoice periods.

Though I want to show current month -1 it doesn´t work over the year end.

How do I create the counter for the month over all years?

Example:

jan15    1

jan31    1

feb15    2

.

.

dec31  24

jan15   25

jan31   26

etc

Period_counter:
Load distinct
[Flag] as [Flag1],
[InvoiceYearMonth],
[InvoiceMonthNum] as [InvoiceMonthCounter],
recno() as [InvoicePeriodCounter]
resident tPeriod_counter
order by [Flag] asc;

kindly

Håkan

1 Solution

Accepted Solutions
daveamz01
Contributor III

Re: Make an MonthCounter

Hi Håkan,

You can transform YearMonth in MonthID using AutoNumber([InvoiceYearMonth]). Then you can use MonthID-1 regardless of year.

Best regards,

David

6 Replies
israrkhan
Valued Contributor II

Re: Make an MonthCounter

i did not get you,

would you like to explain a bit more?

what is expected output?

Not applicable

Re: Make an MonthCounter

In the period_counter table do I expect a new column with a counter like the example below.

Not applicable

Re: Make an MonthCounter

oops! my Picture disappeared

Table1.png

daveamz01
Contributor III

Re: Make an MonthCounter

Hi Håkan,

You can transform YearMonth in MonthID using AutoNumber([InvoiceYearMonth]). Then you can use MonthID-1 regardless of year.

Best regards,

David

timanshu
Contributor III

Re: Make an MonthCounter

Can you give a more clearer picture of  your doubt??

Do you want counter value to increment by one for each entry with in a month or you want counter value to remain same for multiple entries with in a month??

Re: Make an MonthCounter

Maybe this is helpful: http://community.qlik.com/message/563904#563904

- Marcus

Community Browser