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: 
Cap
Contributor II
Contributor II

Calculate number of days in field or current selection

Hi all,

After several research on the subject in our community, i was unable to find a solution to my problem:

I use three filters on a SAP Dashboard : Year, Month, Quarter

I would like to get the number of days of the current selection using only expression so it's calculate in the front end(don't think there is a solution in back end)

Example:

the prospect select 2019 - Q1 - January -> 31 days
the prospect select 2020 - Q2  -> 91 days
The prospect select 2019 -> 365 days

Thanks in advance for your help, really tried to solve that on my own but i'm missing of knownledge with time function i think 😞

Labels (1)
2 Solutions

Accepted Solutions
brunobertels
Master
Master

Hi 

have a look to this function 

monthstart() and monthend() for Month 

quaterstart() and quarterend() for quarter 

yearstart() and yearend() 

To get the number of day try like this : 

monthend(DateField) - monthstart(DateField) and so on 

 

View solution in original post

MarcoWedel

Having a complete calendar implemented, you could just use

Count(Distinct Date)

to get the number of days matching your selections.

View solution in original post

3 Replies
brunobertels
Master
Master

Hi 

have a look to this function 

monthstart() and monthend() for Month 

quaterstart() and quarterend() for quarter 

yearstart() and yearend() 

To get the number of day try like this : 

monthend(DateField) - monthstart(DateField) and so on 

 

MarcoWedel

Having a complete calendar implemented, you could just use

Count(Distinct Date)

to get the number of days matching your selections.

Cap
Contributor II
Contributor II
Author

Thanks to both of you, the two solution are both interresting 👍👍 I now know how to work this.

 

Thank you so much