Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

I have Year and Month how to Get No of Days in Month

Hi Dears,

I have a table of Years and Months like This

Month,     Year

Dec,          2015

Nov,          2015 

Jan,           2016

Oct,          2015

I want to know in an accurate way how many days are there in each month like this

Month,     Year,          Days

Dec,          2015          31 

Nov,          2015          30

Jan,           2016          31

Oct,          2015          31

I Tried

LOAD *, (MonthEnd(Month)-MonthStart(Month)) as Days

but this resulted in 31 Days in all months although it is known that Nov is only 30 Days.

Thanks in advance

stalwar1

sokkorn_cheav

swr

gwassenaar

jontydkpi

1 Solution

Accepted Solutions
sunny_talwar

May be like this:

LOAD Month,

          Year,

          Day(MonthEnd(MakeDate(Year, Month(Date#(Month, 'MMM')), 1))) as Days

FROM...

Update: Sample attached

Capture.PNG

View solution in original post

5 Replies
sunny_talwar

May be like this:

LOAD Month,

          Year,

          Day(MonthEnd(MakeDate(Year, Month(Date#(Month, 'MMM')), 1))) as Days

FROM...

Update: Sample attached

Capture.PNG

Anonymous
Not applicable
Author

One way, you can use Inline, like this?

load * inline

[Month, Days

Jan, 31

Feb, 28/29

Mar, 31

so on..

];

then you can link it or map it.

MarcoWedel

Hi,

another solution might be:

Day(AddMonths(Date#(Month&Year,'MMMYYYY'),1)-1) as Days

hope this helps

regards

Marco

Chanty4u
MVP
MVP

Nice  Sunny T

sunny_talwar

Thanks brother