Multiple Date Fields (Fact Table) - Linking with Time Dimension
I have a fact table that has multiple date columns.
I can make a time dimension, but it has to be joined to a particular date column. This becomes difficult because of the limit in having multiple date fields reference one time dimension. I can see possibly
creating a date table which contains all dates, link to fact as well as time dimension table. I am trying to better visualize the table layout on this one. Or are there possibily better ways of looking at this senerio
Any idea's
Figured this one out; going to use one time dimension - what looking too much into the details in regard to this scenerio
Similar Messages
-
How to insert data into two tables linke with foreign key..
I have two tables
1)EMP(emp_ID,username,emp_type_code)
emp_ID is primary key, emp_type_code is a foreign key references emptype table.
2)emptype(emp_type_code,emp_type_descripton)
emp_type_code is primary key
Could anyone help me ..how to insert data into EMP table. How to insert data into two tables linke with foreign key..CREATE TABLE "CATDB"."DWDIMUSER"
"USER_ID" NUMBER(10,0) NOT NULL ENABLE,
"SPECIALTY_ID" NUMBER(10,0),
"FULLNAME" VARCHAR2(20 BYTE),
"FNAME" VARCHAR2(20 BYTE),
"LNAME" VARCHAR2(20 BYTE),
"USER_SUBTYPE" VARCHAR2(20 BYTE),
CONSTRAINT "DIMUSER_PK" PRIMARY KEY ("USER_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "CATDB" ENABLE,
CONSTRAINT "DIMUSER_DIMSPECIALTY_FK" FOREIGN KEY ("SPECIALTY_ID") REFERENCES "CATDB"."DWDIMSPECIALTY" ("SPECIALTY_ID") DISABLE
CREATE TABLE "CATDB"."DIMSPECIALTY"
"SPECIALTY_ID" NUMBER(10,0) NOT NULL ENABLE,
"SPECIALTY_NAME" VARCHAR2(100 BYTE),
CONSTRAINT "DIMSPECIALTY_PK" PRIMARY KEY ("SPECIALTY_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "CATDB" ENABLE
INSERT INTO DIMUSER (FullName, FNAME, LNAME, USER_TYPE, USER_SUBTYPE)
SELECT DISTINCT
Engineer AS FullName,
regexp_substr(Engineer , '[^,| ]+', 1, 1) as FName,
regexp_substr(Engineer , '[^,| ]+', 1, 2) as LName ,
'Engineer'
FROM EMPLOYEELOOKUP;
INSERT INTO DIMSPECIALTY (SPECIALTY_NAME)
SELECT DISTINCT SPECIALITY
FROM EMPLOYEELOOKUP;
COMMIT;
CREATE TABLE employeelookup ...IS A TABLE THAT HAS ALL THE DATA NEDED TO BE FILLED IN BOTHE TABLES...
CREATE TABLE "CATDB"."EMPLOYEELOOKUP"
"EMPLOYEELOOKUP_ID" NUMBER(10,0) NOT NULL ENABLE,
"ENGINEER" VARCHAR2(25 BYTE),
"SPECIALTY" VARCHAR2(20 BYTE),
CONSTRAINT "DIMSPECIALTY_PK" PRIMARY KEY ("EMPLOYEELOOKUP_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "CATDB" ENABLE
DATA IN EMPLOYEELOOKUP
Engineer, Specialty,
John, Dow, Electronis,
Dow, Jons, Technician
Stan Smithers Sales
Mark, Richards Marketing
Jenny, Lane Marketing
John, Lee Sales
I NEED TO LOAD THE FOREIGN KEY IN DIMUSER FROM THE DIMSPECIALTY TABLE?
BY USING THE LOOKUP TABLE TO MARCH THE NAMES UNDER THE Engineer COLUMN, SPECIALTY COLUMNE DISTICTIVLY BY JOINING THE DIMSPECILTY TO RISTIVE THE PRIMARY KEY AND FILL IT IN THE DIMUSER TABLE AS A FOREIGNE KEY. -
All -
I have a TSR dimension data (1 of 12 dimensional attributes) in our forecast fact table which gets updated monthly in our source system and we have to reflect this in our BPC system. What is the best method of updating this data in BPC?
1. Can I update the TSR directly in the forecast fact table and reprocess the application to reflect this in the cube?
2. Do I have to negate that entire fact table row with the old TSR and insert a new row with the new TSR and process the cube?
3. Any other method?
Thanks for your help.You need to explain your requirement a bit more. Why you want to add type or rejection reason in fact table.
In general you should avoid adding textual data in fact.
Fact tables are only supposed to store keys and measures. It can hold textual data in case of degenerate dimension ( i.e if the number of records are same in dimension as well as fact ).
Type or Rejection reason are going to have much less records. You can create a new dimension for them having probably 20 or 30 records.
Disadvantages of adding textual data in fact is, once the fact has millions of records the fact table updates are going to take huge time and also your reports will take long time.
If you have a rejection reason dimension with some 20 records, you can use rejection reason in prompts.
But if the same rejection reason is coming from fact table your prompts performance is going to be very slow since it has to fetch 20 distinct records from millions of records.
Consider these before adding textual data in facts.
Thanks
Edited by: Maqsood Hussain on Dec 5, 2012 9:40 PM -
Hi
I would like to understand what can be the probable issues which I may face in OBIEE 11g if my fact table has non- numeric data (textual data) like type or rejection reason in the fact table.
I am new to the team and the data warehouse consist of textual data in fact table. I am not very much sure whether this approach is correct(unless I am missing latest trend)
Can anybody explain me with example on what can be the issues which we can face with textual data in fact table
Regards
SameerYou need to explain your requirement a bit more. Why you want to add type or rejection reason in fact table.
In general you should avoid adding textual data in fact.
Fact tables are only supposed to store keys and measures. It can hold textual data in case of degenerate dimension ( i.e if the number of records are same in dimension as well as fact ).
Type or Rejection reason are going to have much less records. You can create a new dimension for them having probably 20 or 30 records.
Disadvantages of adding textual data in fact is, once the fact has millions of records the fact table updates are going to take huge time and also your reports will take long time.
If you have a rejection reason dimension with some 20 records, you can use rejection reason in prompts.
But if the same rejection reason is coming from fact table your prompts performance is going to be very slow since it has to fetch 20 distinct records from millions of records.
Consider these before adding textual data in facts.
Thanks
Edited by: Maqsood Hussain on Dec 5, 2012 9:40 PM -
How to delete all data in all tables in one time ?!
1 CREATE OR REPLACE PROCEDURE delete_all_data
2 IS
3 v_statement VARCHAR2 (200);
4 BEGIN
5 FOR i IN (SELECT *
6 FROM user_tables)
7 LOOP
8 v_statement :=
9 'delete table ' || i.table_name ;
10 EXECUTE IMMEDIATE v_statement;
11 END LOOP;
12 commit;
13* END;
SQL> /
Procedure created.
SQL> exec delete_all_data
BEGIN delete_all_data; END;
ERROR at line 1:
ORA-00903: invalid table name
ORA-06512: at "DE2.DELETE_ALL_DATA", line 10
ORA-06512: at line 1
I made the previous code , but it's didn't work with me .... any help for this problem please ?!
I'm just reminder ..... all what I need ,that delete all data in all tables in one time only .
I'm waiting for the answer ..... and thanks in advancecreate or replace
FUNCTION TRUNC_SCHEMA RETURN NUMBER AS
CURSOR select_table IS SELECT TABLE_NAME AS TNAME FROM USER_TABLES ORDER BY 1;
sTableName Varchar2(128);
sUser Varchar2(128);
sConstraintName Varchar2(128);
plsql_block Varchar2(512);
BEGIN
SELECT USER INTO sUser FROM DUAL;
IF ((sUser='SYSTEM') OR (sUser='SYS')) THEN
RETURN 1;
END IF;
EXECUTE IMMEDIATE 'PURGE RECYCLEBIN';
-- DISABLE table's constraints
FOR C1 IN (select CONSTRAINT_NAME, TABLE_NAME from user_constraints where STATUS = 'ENABLED' AND CONSTRAINT_TYPE in ('P','R') ORDER BY R_CONSTRAINT_NAME) LOOP
sConstraintName := C1.CONSTRAINT_NAME;
sTableName := C1.TABLE_NAME;
plsql_block := 'ALTER TABLE ' || sTableName || ' DISABLE CONSTRAINT ' || sConstraintName;
EXECUTE IMMEDIATE plsql_block ;
END LOOP;
FOR D IN select_table LOOP
--get table name
sTableName := D.TNAME;
-- clear table
plsql_block := 'TRUNCATE TABLE ' || sTableName;
EXECUTE IMMEDIATE plsql_block ;
END LOOP;
-- ENABLE table's constraints
FOR C2 IN (select CONSTRAINT_NAME, TABLE_NAME from user_constraints where STATUS = 'DISABLED' AND CONSTRAINT_TYPE in ('P','R') ORDER BY R_CONSTRAINT_NAME desc) LOOP
sConstraintName := C2.CONSTRAINT_NAME;
sTableName := C2.TABLE_NAME;
plsql_block := 'ALTER TABLE ' || sTableName || ' ENABLE CONSTRAINT ' || sConstraintName;
EXECUTE IMMEDIATE plsql_block ;
END LOOP;
RETURN 0;
EXCEPTION WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('ERROR: ' || SQLERRM);
RETURN 1;
END TRUNC_SCHEMA;
/ -
Attribute key not found when there is no data in Fact table
Hi All,
I have a Dimension and Fact table,Dimension has data but Fact table is empty. The Dimension is MOLAP & Measure group is ROLAP. the relation is built on Key column and named column is some other attribute.
When I execute MDX "select { [Measures].[Avg Sales] -- Average type measure} on columns from my_Cube ", this returns a valule with #Error. error message in cell is "The attribute key cannot be found when processing:
Table: 'FACT, Column: 'ID', Value: '0'. The attribute is 'Name' "
I have processed the Dimension with Full and then Cube is processed with Full. but still same error. Please suggest .
Ram MSBI DeveloperHi Ram ,
Since you mentioned "Value: '0'. The attribute is 'Name' ""
I would recommend to have a look at the Key/Name Column's property regarding to the NullProcessing .
Regards, David . -
Insert data into fact table from source database tables
here i try to insert data into fact table from source database tables here is the query
ALTER procedure [dbo].[facttable]
as
insert into [pp dw].dbo.Dimfact(Prod_ID,Production_ID,Material_ID,Equip_ID,WC_ID,Recipe_ID,Quantity,costprice)
select Products.[Product ID],[Production ID],Materials.[Material ID],[Equipment ID],[Work Centre ID],[Recipy ID],Quantity,[cost price]
from
[PRODUCTION PLANNING 2].dbo.[Products],
[PRODUCTION PLANNING 2].dbo.[Production Detail],
[PRODUCTION PLANNING 2].dbo.[Material category],
[PRODUCTION PLANNING 2].dbo.[Materials],
[PRODUCTION PLANNING 2].dbo.[Equipment],
[PRODUCTION PLANNING 2].dbo.[Working Centre] ,
[PRODUCTION PLANNING 2].dbo.[Recipies]
where
Products.[Product ID] in (13, 14, 15, 16, 17) and
[Production Detail].[Production ID] in (1, 2, 3) and
[Materials].[Material ID] in (1, 2, 3, 4, 5) and
[Equipment].[Equipment ID] in (1, 2, 3, 4) and
[Working Centre].[Work Centre ID] in (1, 2, 3) and
[Recipies].[Recipy ID] in (1, 2, 3) and
[Material category].[Category ID] in (8, 9, 10, 11, 12, 13)
and when i execute query it shows me error
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Dimfact_Dimproduct". The conflict occurred in database "pp dw", table "dbo.Dimproduct", column 'Prod_ID'.
ERD IS
HOW TO SOLVE THIS PROBLEM?I cant see any join conditions in your query posted. Whats the purpose of the query above. It will just bring you a cartesian product (cross join) of tables involved subjected to filters. Are you sure this is the correct query?
The error you're getting may be because you've not yet populated DimProduct or may be because of logic you used in popultaing DimProduct causing it to miss some records which is what query is referring to in above case.
Please Mark This As Answer if it solved your issue
Please Mark This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page -
Purchase Order released date field and table name
Hi,
Please tell me the Purchase Order released date field and table name.
Regards
DeepakHi,
Table : EKKO.
Fields : FRGKE,FRGZU.
You can get release date of PO from CDHDR table.
give object value as your po number and check.dont forget to give leading zeros.
The udate will be date field and transaction will be me29n for relaesed po. -
Best way to connect two fact tables when no conformed dimension exists
Can anyone please elaborate how would I connect two fact table without any conformed dimension. Let say FACTA, FACTB. FACTB is related to a dimension "StatusDim". I want to select the count of all FACTA item which are related to FACTB items with
a particular status. I have found the following article but just wondering whether it is the best practise to connect two fact tables directly.
http://bifuture.blogspot.com/2011/11/ssas-selecting-facts-with-reference.html
Thank youHi Ahsan,
After read the blog you posted, I think it's a pretty good solution to create a view in the relational database or a named query in the Data Source View containing as the the columns in FACTA and FACTB. Then build a dimension from it, setting the "Null processing"
property (you have to click the "plus" two times for the "Key Columns" property of the attribute in BIDS to access this property) to "UnknownMember". And then use this dimension for the many-to-many relationship. Dimensions from FactA can benefit of the reference
relationship between FactA and FactB and therefore a powerful solution it is.
Regards,
Charlie Liao
If you have any feedback on our support, please click
here.
Charlie Liao
TechNet Community Support -
Problem with Time Dimension generating
Hello, everybody.
I have a problem with Time Dimension generating with the help of the Standard Wizard.
1. I choose Dimensions -> New -> Using Time Wizard
2. Set Name as "Time"
3. On the next screen I choose ROLAP: Relational Storage
4. On the next screen set Start year: 2003, Number of years: 3
5. On the next screen choose all levels of the Normal Hierarchy
On the 6-th step Wizard complete 60% of job and hang up doing nothing (buttons "Cancel" and "Help" is active).
chapter "Create REL_TIME Dimension Using the TIME Dimension Wizard", step 1-6 of tutorial =(
http://www.oracle.com/technology/obe/11gr1_owb/owb11g_update_getting_started_intro/lesson3/less3_relational.htm
My system characteristics:
Builder client 11.1.0.7.0, warehouse at local computer.
can anybody give me any advice about this problem? =(
thanks in advance.Had this issue been solved please?
I have just come across the exact same problem and this post is the only one i managed to find which describes exactly what is happening to me.
Thanks -
10g - Most detailed table in the time dimension table source is not unique
hi, experts,
I cannot find any solution from google. please help
ERRORS:
BUSINESS MODEL ERP:
[38093] Most detailed table in the time dimension table source 'ERP_YEAR_MONTH' is not unique.Hi Forreging,
the time key is incorrectly specified at the lowest level. In the 'ERP_YEAR_MONTH' table, have you correctly specified the primary key for the table?
For example, if the lowest level of granularity is MONTH, then the appropriate key is probably a combination of YEAR and MONTH (not simply MONTH).
Hope this helps,
Justin -
Problem with the date field in Table Control
I have created a table control in my module programming. One of the column in the table control is a date field which is I/O field.
Now if I enter a value in date field column and hit enter the date field is reset. I dont want the field to get reset and accept valid date field.
I have set type of the column as DATS and I havent used any dictionary fields. The column is from the internal table in the program.
Please suggestIn your PAI, in the LOOP AT <itab> did you
- check date validity
- update internal table
* Sample
LOOP AT itab.
FIELD itab-field MODULE checkfield.
MODULE updateitab.
ENDLOOP.
Look also at SAP documentation like [Table Controls|http://help.sap.com/abapdocu/en/ABENTABLE_CONTROL1_ABEXA.htm] or [Table Controls in ABAP Programs|http://help.sap.com/saphelp_nw04/helpdata/EN/9f/dbac9f35c111d1829f0000e829fbfe/frameset.htm]
Regards,
Raymond -
Unexpected transaction data in fact table
Hi,
I have created customized table having field
SWISSEMPID SWEMPNAME SWADDRESS SWDESIGNATION
SWHIREDATE SUPERVISOR SWISSCOMP ETHNICITY LANGUAGE CURRENCY
On the basis of table , I have created generic data source for text ( empname ) and attr ( empid)
dtp excetuded successfully
but for transaction data , in extract structure I have taken empid and empname for connecting dimension
table to fact table , compensation also selected ( transaction data)
after exectuing dtp i am getting 426000 value , it is repeated for each record
which does not exist in table
Regards,
Vivek
Edited by: Vivek Srivastava on Jan 13, 2010 9:07 AMYou need to explain your requirement a bit more. Why you want to add type or rejection reason in fact table.
In general you should avoid adding textual data in fact.
Fact tables are only supposed to store keys and measures. It can hold textual data in case of degenerate dimension ( i.e if the number of records are same in dimension as well as fact ).
Type or Rejection reason are going to have much less records. You can create a new dimension for them having probably 20 or 30 records.
Disadvantages of adding textual data in fact is, once the fact has millions of records the fact table updates are going to take huge time and also your reports will take long time.
If you have a rejection reason dimension with some 20 records, you can use rejection reason in prompts.
But if the same rejection reason is coming from fact table your prompts performance is going to be very slow since it has to fetch 20 distinct records from millions of records.
Consider these before adding textual data in facts.
Thanks
Edited by: Maqsood Hussain on Dec 5, 2012 9:40 PM -
Creating process for multiple Date fields for update or insert in APEX
hello there,
could someone please help me?
i have a form on Apex based on view that is based on three tables and updating and inserting ok using trigger instead of.
i have a problem now as in my form i have around 75 fileds (items) incuding 30 or more date fields which could be populated or left blank or update later.
so for each date field i have two boxs; one for date, input as dd/mm/yyyy (text field) and second for time, input as 23:45. All dates will be insert or update manually by user. so as i mentioned not all date fields could be poulated at one stage.
so i have created some process and validations and all of them work fine but i came accross if date left blank then (:) giving me problem so i have done following further process for each date field. In real table all the date fields have data type date.
declare
v_my_var date; -- for first date field
str_dy VARCHAR2(10);
dt_indx date;
str_tm VARCHAR2(20);
tm_indx date;
begin
str_dy := :p4_first_date
str_tm := str_dy||' '||substr(:p8_first_date_hh,1,2)||':'||substr(:p8_first_date_HH,4,2);
dt_indx := to_date(str_tm,'DD/MM/YYYY HH24:MI');
IF str_dy is not null then
v_my_var :=dt_indx;
ELSE
v_my_var := NULL;
END IF;
update table 1 set my_date = v_my_var where d_id= :p4_d_id;
end;
above code work fine but one date field of course therefore i have to do same code for each date field with changes and initialise variable again and again for each field.
so i like to ask is there any easy way that is more professional. i was thinking about the procedure and using collection or similar but honestly not much experience on that so could some one please help me?
I will be very thankful.
KRgdsHi,
You can do the needful by re-using the code if you can give the item names as P8_DATE1, P8_DATE_hh1, P8_DATE2, P8_DATEhh2 etc..So your item name just differs by a sequence.
Now you write function which will return desired date value taking above items as input. Pass item names to this function, get session state using APEX_UTIL.GET_SESSION_STATE('item_name') API.
Now modify you code as
FOR i IN 1..30
LOOP
v_date_array[i] = f_get_date('P8_DATE'||i, 'P8_DATEhh'||i);
END LOOP;
....Now you have all date valus in array. Just write one update as follows
UPDATE TABLE1
SET date1 = my_date_array[1], date2 = my_date_array[2]..
WHERE ....Hope it helps :)
Cheers,
Hari -
Fact table enriched with hierachy information
Hi Guys,
I have a fact table design question.
The fact data table (oracle10g) on bottom level RelationshipManager (RM) contains the data columns
for the RM dimension:
FACT TABLE
ID¦RM¦DEPARTMENT¦AGENCY¦REGION¦SALES
1---23--Bronx------------NY---------US-------23232
2---24 ---------------------NY---------US-------87878
3---25-----------------------------------US------ 9999999
This means the fact has been enriched with hierachy information, this is not whats usually done.
Why have I done it? Because the RM is not necessarily always part of a department BUT can also
be directly placed under an agency or a region (agency or region leads).
Have I made the right choice by chosing to enrich the fact table? I could have also build a snow flake
schema by storing hierachy information in a seperate table.
Thanks.with your problem, it might be best to split the dimension into multiple dimensions or multiple attribute dimensions with default values where you do not have a value for example set up RM with a N0_RM and when you don't have data load it there. If I'm looking at this correctly, the problem it appears you have is you have an inconsistent hierarchy. where the rollups can change. having them in the same dimesion would be problematic. If therewere consistancy then you could add members into a single hierarchy something like
US
--No_State
--NY
-----Bronx
------RM23
------No_RM
but from your example I don't see it. If they are seperate dimensions(not attribute dimensions) then you could load based on date. If they are attribute dimensions, then look at varying attributes
Maybe you are looking for
-
Hi Experts I have installed crsyal successfully and when i go to crystal report and select a report and click preview and print i get below message "multiple report views are not permitted" Can someone please tell me whats causing this Thank you Rega
-
20C0001HUS Thinkpad Yoga with digitizer?
Hi! I would like to buy this Thinkpad yoga model and I would like to know if the screen is digitizer enabled and it comes with the pen. What is the storage capacity on this model? I asked various vendors from this site and everybody tells me somethin
-
Hi, I was trying to use the Cube USB speakers with the Mac Mini. They seem to work, the system recognizes them, I can see them in the list of devices in System preferences -> Sound -> Output. The problem is that the volume is very low even when I put
-
Guest Wireless with Web Portal
I have my guest wireless accepting terms through a web portal, but it seems they have to accept these terms about every 30 minutes to an hour to get access to the internet again. They are not idle, their session just stops working, and when they open
-
Segment E1ADRM4 in idoc SHPMNT05 only allows 10 partners
We have to post an extension of Idoc type SHPMNT05, with all the shipment and delivery information. For a concrete shipment, we have 15 different partners. However, segment E1ADRM4 doesn't allow more than 10 iterations. Why the system only allows to