Fact is a numeric and aggregatable, these are the building blocks of the project.
Ex., Quantity, Price, sales etc.,
Different ways to create facts
- The Fact Creation Wizard is a step-by-step interface that is typically used when you first create a project. It allows you to create multiple facts in a single creation process. This you might have seen in the Project Creation Assistant itself.
- The Fact Editor, which is discussed in Creating and modifying simple and advanced facts, is used to add advanced features to facts that already exist or to create new simple or advanced facts as your project evolves.
- Architect, which is discussed in Creating and modifying simple and advanced facts using Architect, is used to create and modify simple and advanced facts in a visually integrated environment.
—> With Architect you can:
- Create simple facts
- Create multiple facts quickly
- Add a large number of facts during project creation
- Create simple and advanced facts
- Edit existing facts and configure additional schema-level settings
—> With the Fact Creation Wizard you can:
- Create simple facts
- Create multiple facts quickly
- Add a large number of facts during project creation
—> With the Fact Editor you can:
- Create simple and advanced facts
- Edit existing facts and configure additional schema-level settings
In the Mapping area, select Automatic or Manual:
- Automatic mapping means that all of the tables in the project with the columns used in the fact expression are selected as possible source tables for the fact. You can then remove any tables mapped automatically or select other tables.
- Manual mapping means that all of the tables in the project with the columns used in the fact expression are located but are not selected as possible source tables for the fact. You can then select which of those tables are used as source tables for the fact.
For example, suppose you have a column named Sales, which exists in both the Fact_Sales table and the Fact_Discount table. In the Fact_Sales table, the Sales column contains
revenue data. However, in the Fact_Discount table, the Sales column contains discount data. In other words, although the column name is the same in both tables (Sales), the columns
contain different fact data in each table. When creating the Revenue fact, you must select the Manual mapping method so you can select the Fact_Sales table as a source table for the Revenue
fact. When creating the Discount fact, you must select the Manual mapping method so you can select the Fact_Discount table as a source table for the Discount fact. If you use the Automatic
mapping method in both cases, the MicroStrategy SQL Engine may use the incorrect column for the facts.
Column Alias:
A column alias specifies both the name of the column to be used in temporary tables and the data type to be used for the fact.
By default, the data type for a fact is inherited from the data type of the column on which the fact is defined in the data warehouse. However, there are cases where you may need to change this.
For example, you can define a fact to be the difference between two dates to perform a calculation such as the average number of days between a start and an end date. You could create this fact using the following expression:
ApplySimple(“DateDiff(day,#0, #1)”, [Start_Date_Id],[End_Date_Id])
The data type for this fact is automatically set to a Date data type because the Start_Date_ID and End_Date_ID have Date data types. However, the result of the calculation, that is, the difference between the two dates, is an integer. This is used when a temporary SQL table needs to be created for the calculation. If you did not change the data type of the column alias, then the system uses a Date data type and tries to insert integer data into this column. This can cause an error for some database platforms. To avoid the possibility of an error due to conflicting data types, you should modify the column alias for the fact to change the default Date data type to an Integer data type.
No comments:
Post a Comment