Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
surajap123
Creator II
Creator II

period for master calender

Hi,

I am trying to create a variable for Period for the master calender. I have picked up the below code somewhere, but i dont know what the code does, Could anyone help me how to understand the code?

Also, I want to find is there any simplest way in qlikview to create period. I assume that interval match can be used here, but I am not sure how can i replace the below code with interval match.

LET vCurPeriod     = if (1+ceil((Today()-floor(weekend( yearstart(Today()),0,-1)))/7) <= 4,'01',

if (1+ceil((Today()-floor(weekend( yearstart(Today()),0,-1)))/7) >= 5 AND 1+ceil((Today()-floor(weekend( yearstart(Today()),0,-1)))/7) <9,'02',

if (1+ceil((Today()-floor(weekend( yearstart(Today()),0,-1)))/7) >= 9 AND 1+ceil((Today()-floor(weekend( yearstart(Today()),0,-1)))/7) <14,'03',

if (1+ceil((Today()-floor(weekend( yearstart(Today()),0,-1)))/7) >=14 AND 1+ceil((Today()-floor(weekend( yearstart(Today()),0,-1)))/7) <18,'04',

if (1+ceil((Today()-floor(weekend( yearstart(Today()),0,-1)))/7) >=18 AND 1+ceil((Today()-floor(weekend( yearstart(Today()),0,-1)))/7) <22,'05',

if (1+ceil((Today()-floor(weekend( yearstart(Today()),0,-1)))/7) >=22 AND 1+ceil((Today()-floor(weekend( yearstart(Today()),0,-1)))/7) <27,'06',

if (1+ceil((Today()-floor(weekend( yearstart(Today()),0,-1)))/7) >=27 AND 1+ceil((Today()-floor(weekend( yearstart(Today()),0,-1)))/7) <31,'07',

if (1+ceil((Today()-floor(weekend( yearstart(Today()),0,-1)))/7) >=31 AND 1+ceil((Today()-floor(weekend( yearstart(Today()),0,-1)))/7) <35,'08',

if (1+ceil((Today()-floor(weekend( yearstart(Today()),0,-1)))/7) >=35 AND 1+ceil((Today()-floor(weekend( yearstart(Today()),0,-1)))/7) <40,'09',

if (1+ceil((Today()-floor(weekend( yearstart(Today()),0,-1)))/7) >=40 AND 1+ceil((Today()-floor(weekend( yearstart(Today()),0,-1)))/7) <44,'10',

if (1+ceil((Today()-floor(weekend( yearstart(Today()),0,-1)))/7) >=44 AND 1+ceil((Today()-floor(weekend( yearstart(Today()),0,-1)))/7) <48,'11',

if (1+ceil((Today()-floor(weekend( yearstart(Today()),0,-1)))/7) >=48,'12','P'))))))))))));

Regards,

Suraj

2 Replies
arjunkrishnan
Partner - Creator II
Partner - Creator II

Month & ' - ' & Year as Period,

surajap123
Creator II
Creator II
Author

Hi Arjun,

I want to create the periods based on condition. Infact I am not aware of the functions used in the above code, so want some help to understand the code. To simplify, I am pasting part of the code below, so can you pls explain me its functionality.

if (1+ceil((Today()-floor(weekend( yearstart(Today()),0,-1)))/7) <= 4,'01',

if (1+ceil((Today()-floor(weekend( yearstart(Today()),0,-1)))/7) >= 5 AND

1+ceil((Today()-floor(weekend( yearstart(Today()),0,-1)))/7) <9,'02',

Regards,

Suraj