Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Difficult calculation ... i'm lost -- any help welcome!

Hi all,

I'm having a bit of trouble with a calculation ... maybe someone can help me out or put me on the right direction?!

I have ServiceContracts with a BeginDate ... I need to calculate the exact days available according to the selected $Year and $Month.

ContractnrBeginDate...
15-9-2009...
220-12-2009...
32-3-2010...
46-9-2010...
.........


Also I have to manage to get the exact number of hours for each day:

DayHours
Monday5
Tuesday9
Wednesday9
Thursday9
Friday12
Saturday9
Sunday0


There are different possibilities to take into account with the calculations:

$Year not selected ($Month should be deselected!!) -- ServiceContract.BeginDate until today()

$Year selected $Month not selected
- year(ServiceContract.BeginDate) < $Year and year(today()) = $Year -- days $Year until today()
- year(ServiceContract.BeginDate) < $Year and year(today()) <> $Year -- days $Year
- year(ServiceContract.BeginDate) = $Year and year(today()) = $Year -- ServiceContract.BeginDate until today()
- year(ServiceContract.BeginDate) = $Year and year(today()) <> $Year -- ServiceContract.BeginDate until end $Year
- year(ServiceContract.BeginDate) > $Year -- 0

$Year selected $Month selected
- year(ServiceContract.BeginDate) < $Year and month(today()) = $Month -- days $Year until today()
- year(ServiceContract.BeginDate) < $Year and month(today()) < $Month -- days $Month
- year(ServiceContract.BeginDate) = $Year and month(ServiceContract.BeginDate) = $Month -- ServiceContract.BeginDate until today()
- year(ServiceContract.BeginDate) = $Year and month(ServiceContract.BeginDate) < $Month -- days $Month
- year(ServiceContract.BeginDate) = $Year and month(ServiceContract.BeginDate) > $Month -- 0
- year(ServiceContract.BeginDate) > $Year -- 0

Has someone got an idea??

Is it better to do most of the calculations during the LOAD?? Or should I do most of these things in the frontend??
Anyone can help me on my way??

Thx in advance!!

Anita

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

I now partly solved this ...

At the Load side I'm making calculations per year/month ... so at the front side I only need to sum up these things.

Now I only need to do something with opening times ... but also the calculation shall be done at the LOAD side ... this to make the performance on the front-side better.

View solution in original post

1 Reply
Anonymous
Not applicable
Author

I now partly solved this ...

At the Load side I'm making calculations per year/month ... so at the front side I only need to sum up these things.

Now I only need to do something with opening times ... but also the calculation shall be done at the LOAD side ... this to make the performance on the front-side better.