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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
harleen_singh
Creator III
Creator III

How to count number days in selected months?

I want if count of days in the selected month

suppose if someone select aug and sep in listbox

it should give me 31+ 30=61 days.

how to achievet this?

thanks

5 Replies
jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

=Num(MonthStart(Max(DateFieldName)) - MonthEnd(Min(DateFieldName)))

Hope this helps you.

Regards,

Jagan.

Not applicable

 

below formula will give exact count

=

num(Monthend(max(DateFieldName)) -Monthstart(min([DateFieldName]

)))

Not applicable

 

below formula will give exact count

=

num(Monthend(max(DateFieldName)) -Monthstart(min([DateFieldName]

)))

by

sadick

Not applicable

try somthing like this,

1. Load your Month number in inline table

LOAD * INLINE

[    Month, MonthNum  

     January, 01  

     February, 02  

     March, 03  

     April, 04  

     May, 05  

     June, 06  

     July, 07  

     August, 08  

     September, 09  

     October, 10  

     November, 11  

     December, 12

];

2. Get the max and min date of a month using the formula

Load

monthstart(Date(Makedate($(year3),3,31),'MM/DD/YYYY')) AS Monthstart

monthstart(Date(Makedate($(year3),3,31),'MM/DD/YYYY')) AS Monthstart

Autogenerate 12;

3. Use the function networkdays() and get the date difference

daveelliott
Luminary
Luminary

You could try something like this,

CEIL(NUM(MonthEnd(Max([DateField])) - MonthStart(MIN([DateField]))))