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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
0ctopus
Contributor II
Contributor II

Flag date field with 30 days segments | Qlik View

My data consist of a date field and other fields with values.

I want to add a column and flag the dates in chunks of 30 days in this column. Like chunk 1 for the first 30 days, chunk 2 etc.

A day or more may be missed in the date field so that I can't just count rows. Another thing is that dates have multiple entries for the same date.

I want to do that in the Skript, because other calculation will follow and I need them in the Skript.

It's my first post here I hope I did ok (?).

Labels (2)
1 Solution

Accepted Solutions
Or
MVP
MVP

Psuedo-coding this, you'll want to do something like:

Load Minimum(Date) as MinDate from YourTable; // Easy to find threads about getting the min value from a field

Let vMinDate = Peek(MinDate); // And putting it into a variable

Load Date, Floor((Date - vMinDate) / 30)+1 as ChunkNumber

From YourTable;

View solution in original post

5 Replies
Kushal_Chawda

@0ctopus  Do you want to exclude missing days from Chunk? For example from 01-Jan-2024 to 27-Jan-2024 you have data but 28-Jan, 29-Jan is missing, till here we have 27 days in chunk1, so do you want 30-Jan-2024 to continue chunk from 28th day or still should be count as 30th day?

0ctopus
Contributor II
Contributor II
Author

It seems I just lost my answer... So again:

I want chunks of a 30 days range, they could be just a few values in this time lapse.

Kushal_Chawda

@0ctopus  Not sure I understood. May be few example with dates will be needed

Or
MVP
MVP

Psuedo-coding this, you'll want to do something like:

Load Minimum(Date) as MinDate from YourTable; // Easy to find threads about getting the min value from a field

Let vMinDate = Peek(MinDate); // And putting it into a variable

Load Date, Floor((Date - vMinDate) / 30)+1 as ChunkNumber

From YourTable;

0ctopus
Contributor II
Contributor II
Author

Thank you, I was trying this before but I got an error, like 0 Period. I
assume by now the problem is somewhere in my Skript rather than in the
solution. Thank you.