Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Weekdays

Hello everyone,

I'm not able to bring the sum of days in a given period.

Does anyone have a solution?

Here the result is 81 working days.

01/2011 = 21

02/2011 = 20

03/2011 = 21

04/2011 = 19

Is attached hereto.

6 Replies
yasus
Contributor III
Contributor III

Hi washington,

the right formula is the following one:

aggr(DISTINCT avg(Weekdays),months)

You can use the max or min function as well.

s1.JPG

..you have to change the Total Mode modifications to the following ones:

s2.JPG

erichshiino
Partner - Master
Partner - Master

Hi,

Washington. Not sure about what your problem really is.

Do you want to automatically calculate network days and sum it?

The first problem is the date in your file. It was not recognized as a date, since it was not written in your own date format ( check the sets in the beginning of the script  :SET DateFormat='DD/MM/YYYY';)

You can adjust it at the script (recommended) or at the interface. The syntax will be like this:

date#(months,'MMM/YY') or you can write the date in your own format.

After this, you can use network days to get the number you need:

NetWorkDays(MonthStart(months), Monthend(months))

I used monthstart and monthend to get the first and last date of months (if it is already a real date)

To make it work on a chart with the date as string (as it is now) you can use:

NetWorkDays(MonthStart(date#(months,'MMM/YY')), Monthend(date#(months,'MMM/YY'))) )

or even:

SUM( NetWorkDays(MonthStart(date#(months,'MMM/YY')), Monthend(date#(months,'MMM/YY'))) )

Hope it helps,

Erich

Anonymous
Not applicable
Author

Eric,

Já tenho os dias calculados.

Obrigado.

Anonymous
Not applicable
Author

Yasus,

Como utilizar essa expressão em um objeto texto?

erichshiino
Partner - Master
Partner - Master

Em um objeto de texto pode usar:

= sum( aggr(DISTINCT avg(Weekdays),months) )

O aggr faz o cálculo e retorna o valor para cada um dos valores da dimensão agregadora (neste caso um valor para cada possível valor de months)

Anonymous
Not applicable
Author

Erich,

Parece que agora deu certo.

Obrigado.