14 Replies Latest reply: Dec 9, 2015 8:13 AM by Fabien Pirot

# sale on number of working days

Hello,

Is it possible to calculate revenues over a period by taking into account only working days?

I have sales, I have the number of days over, but the two I block!

• ###### Re: sale on number of working days

If you can create a flag in the script for working days, you should be able to do it very easily

Sum({<WorkDayFlag = {1}>}Sales)

• ###### Re: sale on number of working days

Hello,

I do not practice the script! but with your help it work.

Thank you

• ###### Re: sale on number of working days

Hi,

Can you share Sample file and expected output ?

-Nagarjun

• ###### Re: sale on number of working days

Hi,

Post sample app.if possible .

-Hirish

• ###### Re: sale on number of working days

Hi Fabien,

Sunny's idea is good for answering your question about only taking into account working days, but your next sentence make me think that you're trying to add up the number of working days too. Maybe this Qlikview function will be useful to you:

from the QlikView help file for the networkdays  function

networkdays (start:date, end_date {, holiday})

Returns the number of working days (Monday-Friday) between and including start_date and end_date taking into account any optionally listed holidays. All parameters should be valid dates or timestamps.

Examples:

networkdays ('2007-02-19', '2007-03-01') returns 9

networkdays ('2006-12-18', '2006-12-31', '2006-12-25', '2006-12-26') returns 8

• ###### Re: sale on number of working days

Hello,

Thank you to take a little time on the subject.

Before to integrate a FACT table, I make the calendar with days worked, excluding holidays.

with  "NETWORKDAYS" where days worked = 1

Example Calendar take in the site :

LET vMinDate = Num(Makedate(2015,1,1));

LET vMaxDate = Num(Makedate(Year(Now()),Month(Now()),Day(Now())));

ChampDate:

AUTOGENERATE (1)

WHILE \$(vMinDate)+IterNo()-1<= \$(vMaxDate);

tmpJoursFeries:

[

JoursFeries

01/01/2015

06/04/2015

01/05/2015

08/05/2015

14/05/2015

14/07/2015

15/08/2015

01/11/2015

11/11/2015

25/12/2015

];

Calendrier:

NetWorkDays(\$(vMinDate),\$(vMinDate),JoursFeries) as JoursTravail,

RESIDENT ChampDate;

DROP TABLE ChampDate

• ###### Re: sale on number of working days

Do you know how to attached file an application?

I am a beginner ...

Thanks

• ###### Re: sale on number of working days

Hi Fabien,

2.After clicking on it ,top  right side of your Edit box you see Use Advanced Editor ,Click on it.

3.Next click on Attach bottom right side of your edit box.

-Nagarjun

• ###### Re: sale on number of working days

Hi,

Thanks nagarjuna.kothamand

this is an example qvw.

For a specific date in november : ex : 21.11.2015 = 14 days worked in the month.

Is it possible to get sales in 2014 of 14 working days?

Thanks

• ###### Re: sale on number of working days

Yes, But can you explain clearly and share expected output.

Regards,

Nagarjuna

• ###### Re: sale on number of working days

Hi,

Try this expression to exclude Saturday and Sunday sales.

=Sum({<JourSemaine-={'sam.', 'dim.'}>} MontantFactureSign)

Regards,

Jagan.

• ###### Re: sale on number of working days

Like this????

PFA.....te

• ###### Re: sale on number of working days

Hi,

I'll try to be as precise as possible in my explanations

Taking an example : 20 november 2015, with two holidays in France (01 november and 11 november).

There are 14 wording days in the month

However, in 2014, the fourteenth day of work is 21 november 2014.

I want the sum of sales in November, in the same number of working days in 2014 and in 2015 with a selected date.

For this, i think we should create a dimension that puts the number 1 in the schedule table if it is a working day.

working day = 1

saturday, sunday, holidays = 0

Thank you for your help and time taken