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: 
KuppuswamyS
Contributor II
Contributor II

Count no of days in a month

Hi,

    How to count no of days in a month?

    I have a field Posting date and need to count no of days in a month based on posting date.

   In current month, I need to have the count only till current day. For ex: Today is Sept 25, so it must be only 25 in case of posting date is in this month range.

 I need to achieve this in load statement to sum the value of fields. 

  Thank you. 

 

Labels (1)
1 Solution

Accepted Solutions
Kushal_Chawda

@KuppuswamyS  try below

if([Posting Date] >=monthstart(today()),day(Today()), NoOfDaysExpression)

View solution in original post

6 Replies
Taoufiq_Zarra

@KuppuswamyS  you can use for example Interval, like :

=Interval(Date2-Date1 ,'D')

 

example :

Capture.PNGCapture.PNG

Interval is a script and chart function, so you can use it in Load !

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Kushal_Chawda

@KuppuswamyS  If any dates is missing in your Data then do you still need to count it?

KuppuswamyS
Contributor II
Contributor II
Author

Hi Taoufiq and Kush,

   I managed to get no of days in a month using expressions in pivot table.

    I have posting date field and it has data. If posting date is in current month, I need to get only no of days(as of today) in this month. Can you please help me to get that logic.

Example : If posting date field data is Aug 2020, it is 31 days but if Sept 2020(Current month), today is 25th Sept, (as of today, no of days must be 25). 

Thank you.

   Thank you. 

Taoufiq_Zarra

@KuppuswamyS  can you share a sample data and the expected output ?

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Kushal_Chawda

@KuppuswamyS  try below

if([Posting Date] >=monthstart(today()),day(Today()), NoOfDaysExpression)

KuppuswamyS
Contributor II
Contributor II
Author

It works, Thank you Kush.