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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Karim_Khan
Creator III
Creator III

count of days dynamic on Month selection

Hi Team,

     I have the data from 1950 till 2049 now i got the requirment to calculate the noof days in year.

suppose if i click on

1-JAN-1950  --- 1

1-JAN-1960 --- 1

2-JAN-1980  --- 2

3-JAN-1990  --- 3

10-JAN-2040--- 10

.;

;

;

31-JAN-2050  --- 31

am able to populate the above solution but when i go to next month then also it is showing the same result

1-FEB-1950  --- 1

1-FEB-1960 --- 1

2-FEB-1980  --- 2

3-FEB-1990  --- 3

10-FEB-2040--- 10

But requirement is like that if we select FEB month then it should increase in sequential order till the December

they are looking for some thing like

1-FEB-1950  --- 32

2-FEB-1950  --- 33......

28-FEB-2016----59

29-FEB-2016----60



1-MAR-2016 --- 60

2-MAR-2017 --- 61

Reagrds,

KK

kush141087sureshqvQlikView Forums & Resources

KK
1 Solution

Accepted Solutions
swuehl
MVP
MVP

Date - YearStart(Date) +1 as DayNumOfYear


should work then.

There is also a function DayNumberOfYear, which is based on a 366 days year.

DayNumberOfYear(date[,firstmonth])

View solution in original post

17 Replies
swuehl
MVP
MVP

How do you calculate the number?

Have you tried:

=Max(DATEFIELD) - YearStart(Max(DATEFIELD)) +1

?

Kushal_Chawda

You can do something like below

Data:

LOAD Date

FROM table;

New:

noconcatenate

LOAD *,

          if(Date<>Previous(Date),rangesum(peek('Days'),1),1) as Days

Resident Data

order by Date asc;

drop table Data

Karim_Khan
Creator III
Creator III
Author

I was using the normal form as

day(Date) as DayNum which is giving the position or day number

KK
Anonymous
Not applicable

Hi Karim,

Try this:

=Interval(Max(DATEFIELD)-YearStart(Max(DATEFIELD)),'DD')

Kind regards

Kushal_Chawda

Assuming that You have all the dates in calender


Data:

LOAD Date,

          Year

FROM table;

New:

noconcatenate

LOAD *,

          if(rowno()=1 or Year<>previous(Year),1,if(Year=previous(Year) and Date<>Previous(Date),rangesum(peek('Days'),1),1)) as Days

Resident Data

order by Year,Date asc;

drop table Data;



or try simple if like below


if(rowno()=1 or Year<>previous(Year),1,rangesum(peek('Days'),1)) as Days


swuehl
MVP
MVP

Date - YearStart(Date) +1 as DayNumOfYear


should work then.

There is also a function DayNumberOfYear, which is based on a 366 days year.

DayNumberOfYear(date[,firstmonth])

Karim_Khan
Creator III
Creator III
Author

Manuel as per ur code is is working but it is taking one day less count

if I will click on 31Jan then it is taking 30

KK
Anonymous
Not applicable

Add one Day manually.

Kind regards

Karim_Khan
Creator III
Creator III
Author

done just use +1

KK