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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
sakshikaul
Creator II
Creator II

getting first 15 days of a month

Hi,

I want to display a 1st 15 days of each month  ie if month = Jan the  i want to display staring of a month 1-1-2020 till 15-01-2020. Following code is not working 

if(Batch='A',MonthStart(Date(Link_Date,'DD/MM/YYYY'))& ' - '& MonthStart(Date(Link_Date +15)),'na')as [Credit Period],

Please find the attached image 

 

1 Solution

Accepted Solutions
MayilVahanan

Hi 

Try like below

If(Batch = 'A',
date(MakeDate([Year BW],[Month BW],1),'DD/MM/YYYY')& ' - '& date(MakeDate([Year BW],[Month BW],15),'DD/MM/YYYY' ) ,
If(Batch = 'B',
date(MakeDate([Year BW],[Month BW],16),'DD/MM/YYYY')& ' - '& date(MonthEnd(MakeDate([Year BW],[Month BW])),'DD/MM/YYYY'))) as [Credit Period]

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

6 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

I think this what you intend:

if(Batch = 'A',
	Date(MonthStart(Link_Date), 'DD/MM/YYYY') & ' - ' & Date(MonthStart(Link_Date) + 15, 'DD/MM/YYYY')
	'na'
) as [Credit Period],
Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
sakshikaul
Creator II
Creator II
Author

Hi,

I have implemented below code 

If(Batch = 'A',
MakeDate([Year BW],[Month BW],1)& ' - '& MakeDate([Year BW],[Month BW],15) ,
If(Batch = 'B',
MakeDate([Year BW],[Month BW],16)& ' - '& MakeDate([Year BW],[Month BW],31))) as [Credit Period]

I am getting following result 

1.firstly I am not getting month end date in this 

2. I need date format as DD/MM/YYYY

Please help @sunny_talwar 

 

 

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi,

What I suggest is to create the 1st 15 days of each months within your calendar and use the flag  within your Set Analysis. See below, hope it helps you

 

// this should go within your calendar script

IF(DAY(DateField) <= 15,1,0) AS [%First 15 Days Of Month]

 

 

Hope this helps

sakshikaul
Creator II
Creator II
Author

Hi,

I am getting perfect value for all the months except for Feb month( Please check 1st value )

Untitled.png

I have used the following code:-

If(Batch = 'A',
date(MakeDate([Year BW],[Month BW],1),'DD/MM/YYYY')& ' - '& date(MakeDate([Year BW],[Month BW],15),'DD/MM/YYYY' ) ,
If(Batch = 'B',
date(MakeDate([Year BW],[Month BW],16),'DD/MM/YYYY')& ' - '& date(MakeDate([Year BW],[Month BW],31),'DD/MM/YYYY'))) as [Credit Period]
Please help 

sakshikaul
Creator II
Creator II
Author

@Anil_Babu_Samineni  plesae help

MayilVahanan

Hi 

Try like below

If(Batch = 'A',
date(MakeDate([Year BW],[Month BW],1),'DD/MM/YYYY')& ' - '& date(MakeDate([Year BW],[Month BW],15),'DD/MM/YYYY' ) ,
If(Batch = 'B',
date(MakeDate([Year BW],[Month BW],16),'DD/MM/YYYY')& ' - '& date(MonthEnd(MakeDate([Year BW],[Month BW])),'DD/MM/YYYY'))) as [Credit Period]

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.