I work for a reputed company which uses a space old Oracle reporting tool called Oracle BI Discoverer 11g
. I'm stuck with an ORACLE PL/SQL
calculation. Here's a summary of the report content.
Parameters : Ac. Period Start Date, Report as of date (Report as of date > Ac. Period Start Date).
Report Format : Crosstab
Report Description : This report summarizes recorded time of employees for the above parameterized period, which should show a percentage based on available hours during the assignment period. (Efficiency Report)
Requirements :
- I need to convert YTD Hours to percentages based on a denominator called *“Standard Hours”. (Further elaborated below)
- I need a headcount calculation similar to “COUNT(CASE WHEN (SYSDATE BETWEEN Employee Assignment Start Date AND Employee Assignment End Date) THEN Employee Full Name END)”. But I’m getting an error of unexpected END statement.
*Standard Hour calculation steps for YTD Hours:
- Need to get the number of workdays (excl. Sun & Sat) by employee between parameter values and assignment dates : Similar to “LEAST(:Report as of date,Employee Assignment End Date)-GREATEST(:Ac. Period Start Date,Employee Assignment Start Date)”. But this doesn’t give me workdays
- Multiply that by 7.75
- Entire calculation should be apportioned based on below. Let’s assume following employee’s hours total to 1163.00 for one assignment period. "%" is based on "Chg" consumption of an employee for a single assignment period, "Asmt P".
Dept | Name | Position | Asmt P | Chg | Condition | % | Std
--------- | ---------- | --------- | ------ | ------ | ---------- | --- | ----
O | Ud Jay | Partner | 1/1/16 | 58 | Chg>0, % | 13 | 157
--------- | ---------- | --------- | ------ | ------ | ---------- | --- | ----
C | Ud Jay | Partner | 1/1/16 | 0 | Chg=0,100% | 100 | 1163
--------- | ---------- | --------- | ------ | ------ | ---------- | --- | ----
M | Ud Jay | Partner | 1/1/16 | 327 | Chg>0, % | 77 | 893
--------- | ---------- | --------- | ------ | ------ | ---------- | --- | ----
D | Ud Jay | Partner | 1/1/16 | 4 | Chg>0, % | 1 | 11
--------- | ---------- | --------- | ------ | ------ | ---------- | --- | ----
E | Ud Jay | Partner | 1/1/16 | 36 | Chg>0, % | 8 | 98
I need the requirements addressed.