Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

i need to calculate no of days based on the selection

hello everyone,

i need to calculate number of days based on the selection.

for example: if i select 2014, it should give me the days count from Jan 1st 2014 to 19 Sep 2014,

if i select 2014 and  Jan it should give 31 as count

if i select 2013, it should give 365

like this i need to calculate

can any one please help how to calculate this.

Thanks in Advance

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Check enclosed file..

View solution in original post

6 Replies
simondachstr
Luminary Alumni
Luminary Alumni

Assuming you have a Date field you can try something like this:

=DayNumberOfYear(max(Date))

max(Date) will give you the maximum selected date, thus if you only select 2013, it will return 31-Dec-2013.

DayNumberOfYear() will return you the numbers of days in that particular year...

MK_QSL
MVP
MVP

Considering that you have Month and Year fields as list box..

=IF(GetFieldSelections(Year) and IsNull(GetFieldSelections(Month)), Interval((IF(Today() < YearEnd(MakeDate(Year)),Today(),YearEnd(MakeDate(Year))))-MakeDate(Year),'dd'),

IF(GetFieldSelections(Year) and Not IsNull(GetFieldSelections(Month)),Interval(MonthEnd(MakeDate(Year,Month))-MakeDate(Year,Month),'dd'))

)

Not applicable
Author

Hello Martin,

it is giving the count of max year which is available at my data, not giving count by selection.

Thanks

Not applicable
Author

Hello Manish,

Thanks for the response,

I tried it, it is giving some negative values

Thanks

MK_QSL
MVP
MVP

Check enclosed file..

aveeeeeee7en
Specialist III
Specialist III

Hi

See the Attachment.

Regards

Av7en