Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
desiderio89
Contributor
Contributor

How to determine if today is the 4th day of the month

Hello,

I am trying to implement a if condition where I need to check whether today is the 4th day of the month. Based on that the script would load data from a resident table.

If the script is run on or before 4th day of the month, then load data from start of previous month till current day.
If the script is run after 4th day of the month, then load data from start of current month till current day.

I'm trying it like below. Really appreciate any pointers.

IF( inmonthstodate(2, Today(), 'LOGIC_TO_CHECK_4TH_DAY_OF_CURRENT_MONTH', 0)) THEN
out:
load LDATE AS ODATE resident TABLE1 where LDATE  'LOGIC_TO_PROVIDE_DATE RANGE'
ELSE
out:
load LDATE AS ODATE resident TABLE1 where LDATE >=MonthStart(Today()) and LDATE<=Today();
ENDIF;

store out into out.csv (TXT);

1 Solution

Accepted Solutions
Or
MVP
MVP

Let vTodayDayNum = Day(Today());

IF vTodayDayNum <= 4 THEN

Logic1

ELSE

Logic2

End IF

View solution in original post

2 Replies
Or
MVP
MVP

Let vTodayDayNum = Day(Today());

IF vTodayDayNum <= 4 THEN

Logic1

ELSE

Logic2

End IF

desiderio89
Contributor
Contributor
Author

Thank you so much. This helped me think in the right direction.