BIEE 10g combine month and day data in one report
Hi
I am trying to build a simple model to report employee absence per day against number of employees per month.
There are two challenges:
a) not setting content level of No_of_employees, drilling down along calendar to day level shows the Absence_day numbers, but not the number of employees for the month
b) setting the content level of No_of_employees to month repeats the numbers correctly for each day in a month, but does not aggregate No_of_employees at a higher level (quarter or year)
How do I achieve a report like this without loosing the ability to aggregate numbers at year level?
Report sample
Year Month Date No_of_employees Absence_day
2012 June 06/01 15000 10
2012 June 06/02 15000 8
2012 June 06/03 15000 14
2012 June 06/04 15000 5
2012 June 06/05 15000 6
OBIEE Version: 10.1.3.4.1 (not patched in a while)
The calendar dimension has been build using OWB. Year, quarter and month level do contain negative dimension keys for values at these levels and f_employee joins to the negative values. The lowest level is day (positive dimension key values).
Month June 2012; D_calender.dim_key = -50 (negative value !)
Dates in June 01 - 30, D_calender.dim_key = 100 - 130 (positive values)
Dimension: Calendar
logcial levels: year - Quarter - Month - Detail (= date)
logical key: Date
LTS Fact 1: employees
at month level
physical join: f_employee.cal_fk = D_calender.dim_key
measure: No_of_employees
aggregation: sum
logical:
LTS content level: Calender dimension set to Month
LTS Fact 2: absence
at day level
physical join: f_absence.cal_fk = D_calender.dim_key
measure: Absence_day
aggregation: sum
logical:
LTS content level: Calender dimension set to Detail (= date)
Both facts are LTS for the same Logical Fact table.
Thanks for your help
Regards
Andy
The SQL I get when executing a request:
If I could get Answers to display values of c9 instead of c5 (last few lines of the SQL), my problem may be solved
WITH
SAWITH0 AS (select D1.c1 as c1,
D1.c2 as c2,
D1.c3 as c3,
D1.c4 as c4
from
(select sum(nvl(T116806.FRAVAERSDAG , 0)) as c1,
T116670.DATO as c2,
T116670.AAR_NR as c3,
T116670.MAANED_NAVN as c4,
ROW_NUMBER() OVER (PARTITION BY T116670.DATO ORDER BY T116670.DATO ASC) as c5
from
DM2.D_KALENDER_HIER T116670 /* Aggregation_D_Kalender_Hier */ ,
DM2.F_FRAVAERSPERIODE_DAG_V2 T116806 /* Aggregation_F_FRAVAERSPERIODE_DAG_V2 */
where ( T116670.AAR_NR = 2012 and T116670.DIMENSION_KEY = T116806.D_KALENDER_FK and T116670.MAANED_NAVN = 'April' )
group by T116670.AAR_NR, T116670.DATO, T116670.MAANED_NAVN
) D1
where ( D1.c5 = 1 ) ),
SAWITH1 AS (select D1.c1 as c1,
D1.c2 as c2,
D1.c3 as c3
from
(select sum(T116663.ANSAT) as c1,
T116670.AAR_NR as c2,
T116670.MAANED_NAVN as c3,
ROW_NUMBER() OVER (PARTITION BY T116670.MAANED_NAVN ORDER BY T116670.MAANED_NAVN ASC) as c4
from
DM2.D_KALENDER_HIER T116670 /* Aggregation_D_Kalender_Hier */ ,
DM2.F_ANSAT_I_MAANED_LOENUDB_V2 T116663 /* Aggregation_F_ANSAT_I_MAANED_LOENUDB_V2 */
where ( T116663.KALENDER_DIM_HIER = T116670.DIMENSION_KEY and T116670.AAR_NR = 2012 and T116670.MAANED_NAVN = 'April' )
group by T116670.AAR_NR, T116670.MAANED_NAVN
) D1
where ( D1.c4 = 1 ) )
select case when SAWITH1.c2 is not null then SAWITH1.c2 when SAWITH0.c3 is not null then SAWITH0.c3 end as c1,
case when SAWITH0.c4 is not null then SAWITH0.c4 when SAWITH1.c3 is not null then SAWITH1.c3 end as c2,
SAWITH0.c2 as c3,
SAWITH0.c1 as c4,
cast(NULL as INTEGER ) as c5,
SAWITH0.c1 as c6,
SAWITH1.c1 as c9
from
Sawith0 Full Outer Join Sawith1 On Nvl(Sawith0.C4 , 'q') = Nvl(Sawith1.C3 , 'q') And Nvl(Sawith0.C4 , 'z') = Nvl(Sawith1.C3 , 'z')
order by c1, c2
Similar Messages
-
To find months and days between 2 dates
Hi,
I want to find the months and days between 2 dates.
For Eg.
Date-1 : 25-Aug-2013
Date-2 : 23-Oct-2013
If we consider every month as 30 days it should give
25-Aug-2013 to 30-Aug-2013 = 6 days
01-Sep-2013 to 30-Sep-2013 = 1 Month
23-Oct-2013 to 30-Oct-2013 = 8 days
Total = 1 month and 14 days.
Kindly help at the earliest.
Thanks & Regards
SureshSureshM wrote:
Hi,
I want to find the months and days between 2 dates.
For Eg.
Date-1 : 25-Aug-2013
Date-2 : 23-Oct-2013
If we consider every month as 30 days it should give
25-Aug-2013 to 30-Aug-2013 = 6 days
01-Sep-2013 to 30-Sep-2013 = 1 Month
23-Oct-2013 to 30-Oct-2013 = 8 days
Total = 1 month and 14 days.
Kindly help at the earliest.
Thanks & Regards
Suresh
That's not a good idea though. Be considering every month as 30 days, then comparisons over larger date ranges (years) will be out by more and more days the larger the difference gets.
Your example is also wrong.
For Eg.
Date-1 : 25-Aug-2013
Date-2 : 23-Oct-2013
If we consider every month as 30 days it should give
25-Aug-2013 to 30-Aug-2013 = 6 days
01-Sep-2013 to 30-Sep-2013 = 1 Month
23-Oct-2013 to 30-Oct-2013 = 8 days
The last one should be:
01-Oct-2013 to 23-Oct-2013 = 23 days
giving a result of 1 month and 29 days.
Oracle provides a months_between function to do the calculation.
SQL> select months_between(date '2013-10-23', date '2013-08-25') from dual;
MONTHS_BETWEEN(DATE'2013-10-23',DATE'2013-08-25')
1.93548387
But of course, because the number of days in a month varies, it's not exacly known what the decimal part of the number represents.
However, if you combine methods, using months_between to get the months, and then assume 30 days for a month to get the days part from the remainder, it's more consistent over longer periods...
SQL> ed
Wrote file afiedt.buf
1 with dates as (select date '2013-08-25' as date_from, date '2013-10-23' as date_to from dual)
2 --
3 select months_between(date_to, date_from)
4 ,trunc(months_between(date_to, date_from)) as months
5 ,round(mod(months_between(date_to, date_from),1)*30) as days
6* from dates
SQL> /
MONTHS_BETWEEN(DATE_TO,DATE_FROM) MONTHS DAYS
1.93548387 1 28 -
Using Adobe Acrobat Pro XI and Excel 14.3.8 on a mac.
Saved PDF as "optimized PDF" then "save as other" > spreadsheet > Microsoft Excel Workbook.
Problem: numbers in some random dates are transposed so that month and day are reversed. No particular pattern to these errors. Only fix we've found is to go through and manually check and correct the date errors - there are hundreds of these errors in the document so this is not a good solution.
(Note: Excel columns with dates are specified as "date" fields. All dates are formatted as m/d/yy)
Any ideas what's causing this problem problem and how to fix it?
Thanks in advance![discussion moved to Creating, Editing & Exporting PDFs forum]
-
How to get the difference of two dates in years,months and days
Hi friends,
how to get the difference of two dates in years,months and days
for ex 2 years 3 months 13 days
select (sysdate-date_Start) from per_periods_of_service
thanksSomething like this...
SQL> ed
Wrote file afiedt.buf
1 with t as (select to_date('17-nov-2006','dd-mon-yyyy') as c_start_date, to_date('21-jan-2008','dd-mon-yyyy') as c_end_date from dual union all
2 select to_date('21-nov-2006','dd-mon-yyyy'), to_date('17-feb-2008','dd-mon-yyyy') from dual union all
3 select to_date('21-jun-2006','dd-mon-yyyy'), to_date('17-jul-2008','dd-mon-yyyy') from dual
4 )
5 -- end of test data
6 select c_start_date, c_end_date
7 ,trunc(months_between(c_end_date, c_start_date) / 12) as yrs
8 ,trunc(mod(months_between(c_end_date, c_start_date), 12)) as mnths
9 ,trunc(c_end_date - add_months(c_start_date, trunc(months_between(c_end_date, c_start_date)))) as dys
10* from t
SQL> /
C_START_D C_END_DAT YRS MNTHS DYS
17-NOV-06 21-JAN-08 1 2 4
21-NOV-06 17-FEB-08 1 2 27
21-JUN-06 17-JUL-08 2 0 26
SQL>But, don't forget that different months have different numbers of days, and leap years can effect it too. -
Date separate year, month and day
Hello everyone and thanks in advance, I'm new to this and the truth is not doing this.
Well, I have a PDF with several pages which I designed and has been asking me in a complete date in the format dd / mm / yy and subsequent pages he asks me the same date of birth but in 3 separate fields, day , month and year. I want you when you enter the date the first copy and separate day month and year in others. I tried this but I get
var array_datesol = datesol.split("/")
var year = parseInt(array_datesol[2]);
var month = parseInt(array_datesoll[1]);
var day = parseInt(array_datesol[0]);
this.getField('yearsol').value = year;
this.getField('monthsol').value = month;
this.getField('daysol').value = day;
where is the initial field datesol date and year, month and day where they have to be separately
thanks in advanceAre you getting any errors in the JavaScript debugging console?
You are using the syntax for the 'Custom JavaScript calculation' and this syntax can not be used in the 'simplified field notation. Also you can not use any JavaScript properties, objects, functions, control statments.
When run in the console, I find you have a misspelling of the variable name 'datesol'. I also do not see where you are initializing the value for 'datesol'.
var datesol = event.valueAsString; // get value of this field
var array_datesol = datesol.split("/") ; // make into an array
this.getField('yearsol').value =array_datesol[2]; // get element year
this.getField('monthsol').value = array_datesol[1]; // get month element - fixed variable name
this.getField('daysol').value = array_datesol[0]; // get date element
I would use one of the following so the other fields are only updated when a date has been entered and the leading zeros are displayed:
this.getField('yearsol').value = '';
this.getField('monthsol').value = '';
this.getField('daysol').value = '';
if(event.value != '') {
// get parts of date and print with leading zeros
var datesol = event.value; // get value of this field
var array_datesol = datesol.split('/') ; // make into an array
this.getField('yearsol').value = util.printf('%,304.0f', array_datesol[2]); // get element year
this.getField('monthsol').value = util.printf('%,302.0f', array_datesol[1]); // get month element - fixed variable name
this.getField('daysol').value = util.printf('%,302.0f', array_datesol[0]); // get date element
// or
this.getField('yearsol').value = '';
this.getField('monthsol').value = '';
this.getField('daysol').value = '';
if (event.value != '') {
// get date parts and print with leading zeros
var oDatesol = util.scand('dd/mm/yyyy', event.value); // get date object
this.getField('yearsol').value = util.printf('%,302.0f',oDatesol.getFullYear()); // get element year
this.getField('monthsol').value = util.printf('%,302.0f', oDatesol.getMonth() + 1); // get month element - fixed variable name
this.getField('daysol').value = util.printf('%,302.0f', oDatesol.getDate()); // get date element
// or
this.getField('yearsol').value = '';
this.getField('monthsol').value = '';
this.getField('daysol').value = '';
if(event.vaue != '') {
// get parts of date and format
var oDatesol = util.scand('dd/mm/yyyy', event.value); // get date object
this.getField('yearsol').value = util.printd('yyyy', oDatesol); // get element year
this.getField('monthsol').value = util.printd('mm', oDatesol); // get month element - fixed variable name
this.getField('daysol').value = util.printd('dd', oDatesol); // get date element
If you are going to fill other field, you will need to use the '.valueAsStriing' property or '.toString()' method to retain the leading zeros. -
Subtract two dates to get months and days
I havew to subtract two dates and get the differnce ,
Date issuedDate= myobj.getIssueDate();
Date expirationDate=DateUtils.addMonths(issuedDate, 6);
long timeDiff=expirationDate.getTime()-new Date().getTime();
long daysRemaning=timeDiff/86400000;this is code I get the number of days between the issue date and todays date.now my client wants not just days but months and days , i need suggestions on how to get days and months between any two given datesI have read that it is best to use java.util.Calendar for almost any time related issue.
With some switch statements and a for loop, I think the Calendar class could solve the problem. -
What is the formula to find the months and days between dates
Tricky... The first problem is the intended result. Months have a varying number of days in them, days and weeks have set values. For example the difference between 1st July and 1st September is 2 months but this does not give an accurate count of the number of days (61).
It would be better to calculate the number of days difference and forget the months.
You would need a lookup table showing a numeric value for each date that would show each date with a day value from a starting point. If your earliest date is 01/01/2000 then that would be day zero. Then using the lookup table calculate the day value for your beginning and end dates. Subtract one from the other to get the number of days.
If all your dates are from this year:
You can create your own Cell Format (call it day of the year) Select the Type: Date & Time
drag the icon for Day of Year into the box and delete the others.
Convert your dates to this new Format, subtract one value from the other to get the number of days difference. -
Convert two dates difference to number of years, months and days
Post Author: gigimonu
CA Forum: Formula
I wanted to write a formula (if there is a function I can use) that can convert a date difference to total number of years, months and days example
adate = 10/22/2006
?xdate = current date - adate (answer should be 1 years, 0 months and 0 days)
Please help
ThanksPost Author: V361
CA Forum: Formula
[Years, Months, Days]
DATEVAR FROMDATE := DATE(2000,01,01); // FROM DATE
DATEVAR TODATE := CURRENTDATE; // TO DATE
NUMBERVAR YEARS;
NUMBERVAR MONTHS;
NUMBERVAR DAYS;
STRINGVAR DIFF;
DATEVAR TEMP;
IF TODATE < FROMDATE THEN
(TEMP := TODATE;
TODATE := FROMDATE;
FROMDATE := TEMP);
YEARS := DATEDIFF('YYYY',FROMDATE,TODATE);
IF YEARS > 2 THEN
(YEARS := YEARS - 2;
TEMP := DATE(DATEADD("M",YEARS * 12,FROMDATE));)
ELSE
(YEARS := 0;
TEMP := FROMDATE);
WHILE TRUE DO
(TEMP := DATE(DATEADD('M',1,TEMP));
IF TEMP > TODATE THEN
EXIT WHILE;
MONTHS := MONTHS + 1);
DAYS := DATEDIFF('D',DATE(DATEADD('M',-1,TEMP)),TODATE);
IF MONTHS > 12 THEN
(YEARS := YEARS + INT(MONTHS/12);
MONTHS := MONTHS MOD 12);
DIFF := IIF(YEARS>0 ,TRIM(TOTEXT(YEARS,0)) & " YEARS " ,"0 YEARS ") &
IIF(MONTHS>0,TRIM(TOTEXT(MONTHS,0))& " MONTHS ","0 MONTHS ")&
IIF(DAYS>0 ,TRIM(TOTEXT(DAYS,0)) & " DAYS" ,"0 DAYS"); -
Convert Fiscal Period to Month and day in HR/FI
HI Experts,
i am dealing now with an issue in HR for actual and plan Data.
I have two cubes one for actual and one for plan. The actual cube is just using the satndard BI extractor and the plan cube is loaded per flatfile with fiscal/year Period.
We are working with Fiscal/year period.
Now we want to create a report where we can see both the result in Month and day.
I would like to know how to implement it to get the correct result.
Could you please help me on that way?
Thank you.
GiloSolved by myself.
-
FM to get the number of days in Year,month and days by giving number of day
Hi ALL,
This is quit differnt.
I need to give input the 'start date' and the 'number of days' and get the total days from the start date in year,month and day format.
for example.
start date :01.01.2009
number of days as 32
then i should get
years:0
months :1
days :1
Pleas help me out.hi Anusha,
first u pass the date and the days to the following fm you will get the result date....
data:date type sy-datum,
r_date(10) type c.
date = sy-datum.
CALL FUNCTION 'CALCULATE_DATE'
EXPORTING
DAYS = '32'
MONTHS = '0'
START_DATE = date
IMPORTING
RESULT_DATE = r_date
write:/ r_date.
then you need to pass the result date and the date to the following fm to get the required output...
CALL FUNCTION 'HR_HK_DIFF_BT_2_DATES'
EXPORTING
date1 = r_date
date2 = date
IMPORTING
years = v_years
months = v_months
days = v_days
EXCEPTIONS
invalid_dates_specified = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
here u will get the difference in days, months and year...
i hope u wil get help from this...
regards
Ashu Singh -
Any F.Module is there to get 'Month and day ' from the given input number
Hi experts,
I am working on Inventory withdrawl report and in the selection screen, If i enter the CHARG (Batch number) then I need to display the posting date by default in the next selection input based on the Batch number.
In the selection screen :
Batch : 7111WF0211.
Posting Date : (I need to display by default based on batch number).
My requirement is, in the above Batch first digit '7' is the year.
And from 2nd to 4th digit. i.e., 111. I need to find out month and day from 111.
I mean from 1 to 365 days, In which day and which month '111' will come ?
Please send me the code or suitable Function Module. Your help will be appreciated.
Thanks,
Ranji.Use FM ADD_TIME_TO_DATE
Do this
days = batch+1(3).
days = days - 1.
Call Function 'ADD_TIME_TO_DATE'
exporting
i_idate = '01.01.2008'
i_time = days
i_iprkz = 'D'
importing
o_idate = date_p_d
You will get the date in date_p_d.
But what about Leap years? IS the first number the year?
IF so pass in i_idate the first of january of that year so you get the correct day depending if it is a leap year or not
Edited by: Ramiro Escamilla on Feb 26, 2008 9:56 PM -
Leading zeros for Month and Day in filename.
Hello,
I am in Jdev 10.1.3.3.0
One of my requirement is to have a file name concatenated with current month and day (example: <filename><02><23>).
Used the xpath as following and returns an output as *'filename223'*:
concat('filename',xp20:month-from-dateTime(ora:getCurrentDate()),xp20:day-from-dateTime(ora:getCurrentDate()),'.txt')
what changes I need to make in my Xpath to get the file name as *'filename0223'*
Thanks in advance!
Regards,
RakeshI was googling on the date format used in BPEL to achieve various format types. Specially I was searching for my requirement : <filename><current month with leading zeros if month is single digit><current day with leading zeros if day is single digit>(ie. if the month is february and day is 23rd, then my filename should be *<filename><02><23>*).
I found a link which helped solving my problem :
http://plane.javaeye.com/blog/161316
I changed my Xpath to :
concat('filename',xp20:format-dateTime(ora:getCurrentDate(),'[M01][D01]'),'.txt')
And I got my expected result : *'filename0223.txt'*
Regards,
Rakesh -
Get Months and Days -- Problem with months_between
Hi,
For a report, I need to convert days as months and days for eg 370 days as 12 months 5 days.
I tried below query
with t as (
select
maturity_date - value_date tenor
from account_master)
select
trunc(mod(months_between(trunc(sysdate,'YYYY')+ tenor,trunc(sysdate,'YYYY')),30)) month,
(trunc(sysdate,'YYYY')+tenor)-add_months(trunc(sysdate,'YYYY'),trunc(months_between(trunc(sysdate,'YYYY')+ tenor,trunc(sysdate,'YYYY')))) "day"
from t
And i am getting output as
MONTH day
11 30
23 30
11 30
1 5
11 30
11 30
11 30
0 6
11 30
for Number of days
TENOR
365
730
365
36
365
365
365
6
365
As you can see for 365 days i am getting Months as 11 and days as 30
and for 730 days i am getting months as 23 and days as 30.
I want 365 days as 12 months and 0 days.
I think it is months_between function that is creating this problem.
Can anyone suggest another way of accomplishing this?
Thanks and Regards
Amit Trivedi2008 is a leap year! so it's 366 days long. therefore, 365 days is really only 11 months and 30 days (if you start counting from Jan 01, which is what you are doing).
so the number of months and days between is dependent on the starting date (consider a range of 30 days starting on Jan 01, Feb 01 (leap year), Feb 01 (non-leap year) and Apr 01).
so:
with t as (
select maturity_date - value_date tenor, value_date d1 from account_master
select
trunc(months_between(d1+ tenor,d1)) months,
d1+tenor - add_months(d1,trunc(months_between(d1+ tenor,d1),30)) days
from t
or better yet:
select
trunc(months_between(maturity_date,value_date)) months,
maturity_date - add_months(value_date,trunc(months_between(maturity_date,value_Date))) days
from account_master
/ -
I'm trying to calculate the number of days until your next birthday. Only using current month, day and birth month and day. I can get close but i'm way off. When i enter in the next day, the amount of days is supposed to be 364. This is where I am having problems. I know my code is way off. I just need some guidance please!
Attachments:
D5.7_1.vi 8 KBI just had a little fun with the Time Record...
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Attachments:
D5.7_1_BD.png 19 KB -
How to combine sales and delivery data
hi
i have requirement to make a report from sales as well as deliveries. Important fields in report are sales document , material , plant , sales document type , country key , sold to party , ordered quantity , delivered quantity , price from vakon ( KBETR ), actual goods issue date.
The required extractors are 2LIS_11_VASCL, 2LIS_11_V_SSL ,2LIS_11_VAKON.
Problem is how to combine sales and delivery data as V_SSL has different key figures.Multicube is not the solution as dont have plant , sold to party and many other fields in V_SSL.
Kindly suggest how to combine sales and deivery data.
Regards,
MonikaI guess you do have shipping point in delivery.
In most scenarios shipping point may not(or) may be same like order plant.
Although they are different you can still roll up the delivery information to order level by plant since you have order # available as reference key in delivery.
With this reference key you can convert all delivery information to order (item) level.
I guess you can use one merge ODS with one cube (or) with 2 ODS for each at order level for validation.
You may have to map delivery type to order type as per R3 configuration as well.
speak with any Logistics guys for help.
cheers
Martin
Maybe you are looking for
-
I have changed my apple e-mail address in itunes and apple successfuly but now, every time I use my iphone 5 it is asking me to sign in but it still has my old e-mail address there so when I enter my password it says wrong id or password. In setting
-
Chats in one grouped window, most recent pops up
Hi I installed Beta because my sister doesnt like IMing, and I don't like texting at work. Anyway-- I have my all of my chats into 1 window, but one thing is really annoying me, how do I stop from a chat going up to the top, when a new message is sen
-
How import data on one tablespace and indexes on another tablespace
i have import dump from from database in oracle 10g as c:> imp userid=system/password full=y file=d:\ful.dmp log=d:\full.log Now i want import tables data on tablespace datatb and indexes on tablespace indextb. how i can do this job Thanks
-
Question about class PackedInteger.
Dear All, i was searching for sth that can read an integer by using FileInputStream , i mean to take it in the form of an integer not bytes as usual , and i found this class called PackedInteger on that link : http://www.oracle.com/technology/documen
-
Help writing a search bash function
hi i want to make me a bash function which executes find -iname '*[foo]*' my try function search { find -iname '*$1*' didn't work