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: 
ananyaghosh
Creator III
Creator III

How can I calculate the number of wednesday exists in a date range?

!Hi,

I have created a date filed and assign the value to a variable vDate and I have a date range also and assign the value to a variable vRANGE. Now if the use select vDate as 24/1/2018 and range as 9, the I have to calculate the number of Wednesday which is actually the creation date in that range.

SO if vDate is 24/1/2018 and vRange is 9, the the date range is 15/1/2018 To 24/1/2018 and I need to calculate how many weekday means Sunday, Monday, Tuesday, Wednesday, Thrusday, Friday and Saturday is in between in that date range?

I have used the below set analysis for this purpose:

count({$<CREATION_DATE={">$(=(Date(Date#('$(vDATE)','M/DD/YYYY')-if('$(vRANGE)'='0','1','$(vRANGE)'))))<=$(vDATE)"}>}weekday(CREATION_DATE))

but it gives me nothing.

so any idea will be appreciated.

Thanks,

Sandip Ghosh

23 Replies
gerry_hdm
Creator II
Creator II

you cann the WEEKdaynumber Settings and you cann Count

num(weekday(Fabkal.DATE)) as #WeekDayNum,

swuehl
MVP
MVP

Have a look at the Valueloop() parameter. They are defining a different date range in the example, Today() to Today()+9 days ahead.

You may adapt to your needs, like

=SubstringCount(concat( (weekday(date(ValueLoop(num(Today())-8,num(Today()),1)))) ,','),'Wed')

ananyaghosh
Creator III
Creator III
Author

Hi Raju,

Thanks for reply. It gives me huge confidence to solve the data problem in my data model.

ananyaghosh
Creator III
Creator III
Author

Hi Stefan,

Thank you very much for your help. It works for me and I think we trust this forum for this type of help from a very knowledgeable man like you. Thank you very much.

Thanks,

Sandip Ghosh