Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
lomi89
Contributor III
Contributor III

Counter by two dimensions

Hello,

I would like to develop a counter on the script.

I think it is eassier with an example:

ID DATE (DAILY) Counter
1111 01/01/2020 1
1111 02/01/2020 1
1111 03/01/2020 1
1111 04/01/2020 1
1111 05/01/2020 1
1111 ---- 1
1111 31/01/2020 1
1111 01/02/2020 2
1111 02/02/2020 2
1111 03/02/2020 2
1111 04/02/2020 2
1111 05/02/2020 2
1111 ---- 2
1111 29/02/2020 2
2222 01/01/2020 1
2222 02/01/2020 1
2222 03/01/2020 1
2222 04/01/2020 1
2222 05/01/2020 1
2222 ---- 1
2222 31/01/2020 1
2222 01/02/2020 2
2222 02/02/2020 2
2222 03/02/2020 2
2222 04/02/2020 2
2222 05/02/2020 2
2222 ---- 2
2222 29/02/2020 2

 

I need to count by ID and by Month (the date is days).

Thank you very much.

 

 

 

Labels (3)
1 Reply
abhijitnalekar
Specialist II
Specialist II

Hi @lomi89 ,

Please do the changes in the script as below. (I am assuming that we have a month field in the data. or we can create it)

 

load *,
AutoNumber(key) as Inumber;

load *

,ID &'_'&Month as key

inline
[
ID , DATED , Month
1111 , 01-01-2020 , 1
1111 , 02-01-2020 , 1
1111 , 03-01-2020 , 1
1111 , 04-01-2020 , 1
1111 , 05-01-2020 , 1
1111 , 31-01-2020 , 1
1111 , 01-02-2020 , 2
1111 , 02-02-2020 , 2
1111 , 03-02-2020 , 2
1111 , 04-02-2020 , 2
1111 , 05-02-2020 , 2
1111 , 29-02-2020 , 2
2222 , 01-01-2020 , 1
2222 , 02-01-2020 , 1
2222 , 03-01-2020 , 1
2222 , 04-01-2020 , 1
2222 , 05-01-2020 , 1
2222 , 31-01-2020 , 1
2222 , 01-02-2020 , 2
2222 , 02-02-2020 , 2
2222 , 03-02-2020 , 2
2222 , 04-02-2020 , 2
2222 , 05-02-2020 , 2
2222 , 29-02-2020 , 2


]

Regards,
Abhijit
keep Qliking...
Help users find answers! Don't forget to mark a solution that worked for you!