I am using this cube to retrieve data from my OLTP Database
<?xml version="1.0"?>
<Schema name="Test36">
<Cube name="Test36Cube">
<Table name="fact_table"/>
<Dimension name="Year Month Day" foreignKey="id_date">
<Hierarchy hasAll="false" primaryKey="id_date">
<Table name="transaction_date"/>
<Level name="Year" column="year" uniqueMembers="true" levelType="TimeYears" type="Numeric"/>
<Level name="Month" column="month" uniqueMembers="false" ordinalColumn="monthNumber" nameColumn="month" levelType="TimeMonths" type="Numeric"/>
<Level name="Day" column="day" uniqueMembers="false" levelType="TimeDays" type="Numeric"/>
</Hierarchy>
</Dimension>
<Dimension name="Txn type">
<Hierarchy hasAll="false">
<Level name="txn type" column="tx_type" uniqueMembers="true"/>
</Hierarchy>
</Dimension>
<Measure name="Amount" column="tx_amount" aggregator="sum" formatString="Standard"/>
</Cube>
</Schema>
When I add the dimension "Txn type", data for "year month day" is not loaded for each month. Data for only some months is retrived. I am not able to understand the reason behind this error. Can anybody help?
I want to analyze some dynamics of the some process. For that I use Saiku analytics plugin CE for Pentaho Business Intelligence Server CE 5.0.1.
There is a table of facts and a table of dimensions that using to perform some aggregations. Dimensions represent the hierarchy "Year - Month - Day".
I built some report in two cuts - by year and months. Report looks as follows:
The data it shows is correct:
If I define an independent dimension "Month", the report is looks right:
However, the data already is not right:
I tried to add the inverse dimension "Month - Year", but did not see any data.
Is there a way to define a dimension, where the report will not include empty cells?
I found the solution - the problem was in the wrong dimension of date.
See detailed answer here: Create a date range in mysql
New Mondrian schema:
<Schema name="MondrianSchema">
<Dimension type="TimeDimension" visible="true" highCardinality="false" name="X dimension">
<Hierarchy name="X_hierarchy" visible="true" hasAll="true" primaryKey="date_key">
<Table name="tbl_declaration_date_dim" schema="dbo">
</Table>
<Level name="Year" visible="true" table="tbl_declaration_date_dim" column="Year" nameColumn="Year" type="Numeric" uniqueMembers="true" levelType="TimeYears" hideMemberIf="Never">
</Level>
<Level name="Month" visible="true" table="tbl_declaration_date_dim" column="Month" nameColumn="Month" ordinalColumn="Month" type="Numeric" uniqueMembers="false" levelType="TimeMonths" hideMemberIf="Never">
</Level>
<Level name="Day" visible="true" table="tbl_declaration_date_dim" column="Day" nameColumn="Day" ordinalColumn="Day" type="Numeric" uniqueMembers="false" levelType="TimeDays" hideMemberIf="Never">
</Level>
</Hierarchy>
</Dimension>
<Dimension type="TimeDimension" visible="true" name="Y dimension">
<Hierarchy name="Y_Hierarchy" visible="true" hasAll="true" primaryKey="date_key">
<Table name="tbl_declaration_date_dim" schema="dbo" alias="">
</Table>
<Level name="Year" visible="true" table="tbl_declaration_date_dim" column="Year" nameColumn="Year" type="Numeric" uniqueMembers="true" levelType="TimeYears" hideMemberIf="Never">
</Level>
<Level name="Month" visible="true" table="tbl_declaration_date_dim" column="Month" nameColumn="Month" ordinalColumn="Month" type="Numeric" uniqueMembers="false" levelType="TimeMonths" hideMemberIf="Never">
</Level>
<Level name="Day" visible="true" table="tbl_declaration_date_dim" column="Day" nameColumn="Day" ordinalColumn="Day" type="Numeric" uniqueMembers="false" levelType="TimeDays" hideMemberIf="Never">
</Level>
</Hierarchy>
</Dimension>
<Cube name="tbl_application_cube" caption="..." visible="true" description="..." cache="true" enabled="true">
<Table name="tbl_appl_olap_fact" schema="dbo">
</Table>
<DimensionUsage source="X dimension" name="X axis" visible="true" foreignKey="date_dim" highCardinality="false">
</DimensionUsage>
<DimensionUsage source="Y dimension" name="Y axis" visible="true" foreignKey="date_dim">
</DimensionUsage>
<Measure name="DeclarationCount" column="declaration_id" aggregator="count" visible="true">
</Measure>
</Cube>
</Schema>
I am working on a BI project. I am using mondian olap server and jPivot. I am using star model in schema file. The mdx query takes forever to run when I click on the last plus button for drilldown (coming from the right). In the DB there are only around 5000 records. I am using oracle database. The first mdx query is
SELECT NON EMPTY {[Measures].[Revenue]} ON COLUMNS,
NON EMPTY ({([Stream].[All Stream],[Portfolio].[All Portfolio],[Serviceline].[All Serviceline], [Year].[All Year], [Month].[All Month], [Department].[All Department])}) ON ROWS
FROM [RevenueBudget]
WHERE ([Time].[201404] : [Time].[201508])
I have tried executing the query(fourth level) in schema work bench. It hardly takes 40 sec. to execute. I have also checked the background sql queries using java profiler. But its well around one min. So why it is taking so long for jpivot to display the records, if I am right its the problem of jpivot. Any help is highly expected.
The fourth level MDX query got from JPivot MDX editor is below
select NON EMPTY {[Measures].[Revenue]} ON COLUMNS,
NON EMPTY Hierarchize(Crossjoin({[Stream].[All Stream]}, Union(Crossjoin({[Portfolio].[All Portfolio]}, Union(Crossjoin({[Serviceline].[All Serviceline]}, Union(Crossjoin({[Year].[All Year]}, Union(Crossjoin({[Month].[All Month]}, {[Department].[All Department]}), Crossjoin({[Month].[All Month]}, [Department].[All Department].Children))), Crossjoin({[Year].[All Year]}, Union(Crossjoin([Month].[All Month].Children, {[Department].[All Department]}), Crossjoin([Month].[All Month].Children, [Department].[All Department].Children))))), Crossjoin({[Serviceline].[All Serviceline]}, Union(Crossjoin([Year].[All Year].Children, Union(Crossjoin({[Month].[All Month]}, {[Department].[All Department]}), Crossjoin({[Month].[All Month]}, [Department].[All Department].Children))), Crossjoin([Year].[All Year].Children, Union(Crossjoin([Month].[All Month].Children, {[Department].[All Department]}), Crossjoin([Month].[All Month].Children, [Department].[All Department].Children))))))), Crossjoin({[Portfolio].[All Portfolio]}, Union(Crossjoin([Serviceline].[All Serviceline].Children, Union(Crossjoin({[Year].[All Year]}, Union(Crossjoin({[Month].[All Month]}, {[Department].[All Department]}), Crossjoin({[Month].[All Month]}, [Department].[All Department].Children))), Crossjoin({[Year].[All Year]}, Union(Crossjoin([Month].[All Month].Children, {[Department].[All Department]}), Crossjoin([Month].[All Month].Children, [Department].[All Department].Children))))), Crossjoin([Serviceline].[All Serviceline].Children, Union(Crossjoin([Year].[All Year].Children, Union(Crossjoin({[Month].[All Month]}, {[Department].[All Department]}), Crossjoin({[Month].[All Month]}, [Department].[All Department].Children))), Crossjoin([Year].[All Year].Children, Union(Crossjoin([Month].[All Month].Children, {[Department].[All Department]}), Crossjoin([Month].[All Month].Children, [Department].[All Department].Children)))))))))) ON ROWS
from [RevenueBudget]
where ([Time].[201304] : [Time].[201508])
The schema XML file is
<Schema name="RevenueBudget">
<Cube name="RevenueBudget" cache="true" enabled="true">
<Table name="MVW_DIMENSION_TRANSACTIONS"> </Table>
<Dimension name="Time" type="TimeDimension" foreignKey="DIMENSION_TRANSACTION_ID">
<Hierarchy hasAll="false" primaryKey="DIMENSION_TRANSACTION_ID">
<Table name="MVW_DIMENSION_TRANSACTIONS"/>
<Level name="YEAR_MONTH" column="YEAR_MONTH" type="Numeric" uniqueMembers="false"
levelType="TimeYears"/>
</Hierarchy>
</Dimension>
<Dimension type="StandardDimension" foreignKey="STREAM_MASTER_ID" name="Stream">
<Hierarchy allMemberName="All Stream" defaultMember="All Stream" hasAll="true" primaryKey="STREAM_MASTER_ID">
<Table name="MVW_STREAM_MASTERS">
</Table>
<Level name="StrName" column="STREAM_DESCRIPTION" keyColumn="STREAM_MASTER_ID" nameColumn="STREAM_DESCRIPTION" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never">
</Level>
</Hierarchy>
</Dimension>
<Dimension type="StandardDimension" foreignKey="PORTFOLIO_MASTER_ID" name="Portfolio">
<Hierarchy allMemberName="All Portfolio" defaultMember="All Portfolio" hasAll="true" primaryKey="PORTFOLIO_MASTER_ID">
<Table name="MVW_PORTFOLIO_MASTERS">
</Table>
<Level name="PortfolioName" column="PORTFOLIO_DESCRIPTION" keyColumn="PORTFOLIO_MASTER_ID" nameColumn="PORTFOLIO_DESCRIPTION" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never">
</Level>
</Hierarchy>
</Dimension>
<Dimension type="StandardDimension" foreignKey="SERVICELINE_MASTER_ID" name="Serviceline">
<Hierarchy allMemberName="All Serviceline" defaultMember="All Serviceline" hasAll="true" primaryKey="SERVICELINE_MASTER_ID">
<Table name="MVW_SERVICELINE_MASTERS">
</Table>
<Level name="ServicelineName" column="SERVICELINE_DESCRIPTION" keyColumn="SERVICELINE_MASTER_ID" nameColumn="SERVICELINE_DESCRIPTION" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never">
</Level>
</Hierarchy>
</Dimension>
<Dimension type="StandardDimension" foreignKey="YEAR_ID" name="Year">
<Hierarchy allMemberName="All Year" defaultMember="All Year" hasAll="true" primaryKey="YEAR_ID">
<Table name="MVW_YEAR"></Table>
<Level name="YearId" column="YEAR" keyColumn="YEAR_ID" nameColumn="YEAR" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never">
</Level>
</Hierarchy>
</Dimension>
<Dimension type="StandardDimension" foreignKey="MONTH_ID" name="Month">
<Hierarchy allMemberName="All Month" defaultMember="All Month" hasAll="true" primaryKey="MONTH_ID">
<Table name="MVW_MONTH">
</Table>
<Level name="MonthName" column="MONTH" keyColumn="MONTH_ID" nameColumn="MONTH" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never">
</Level>
</Hierarchy>
</Dimension>
<Dimension type="StandardDimension" foreignKey="DEPARTMENT_MASTER_ID" name="Department">
<Hierarchy allMemberName="All Department" defaultMember="All Department" hasAll="true" primaryKey="DEPARTMENT_MASTER_ID">
<Table name="MVW_DEPARTMENT_MASTERS">
</Table>
<Level name="DepartmentName" column="DEPARTMENT_DESCRIPTION" keyColumn="DEPARTMENT_MASTER_ID" nameColumn="DEPARTMENT_DESCRIPTION" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never">
</Level>
</Hierarchy>
</Dimension>
<Measure name="Revenue" column="REVENUE_AMOUNT" datatype="Numeric" aggregator="sum" visible="true"></Measure>
</Cube>
</Schema>
I wonder if moving the set to the WITH clause helps?
WITH
SET [TargetSet] AS
[Stream].[All Stream]*
[Portfolio].[All Portfolio]*
[Serviceline].[All Serviceline]*
[Year].[All Year]*
[Month].[All Month]*
[Department].[All Department]
SELECT
NON EMPTY
{[Measures].[Revenue]} ON COLUMNS
,NON EMPTY
[TargetSet] ON ROWS
FROM [RevenueBudget]
WHERE
[Time].[201404] : [Time].[201508];
I need to create an OLAP View just from one table in MySQL.
I need to get information from the following columns in my table: Date, Machine, Level, Item, Code, Comment, Downtime.
So I created this Mondrian Schema:
<Schema name="ExampleSchema">
<Cube name="ExampleCube">
<Table name="example_table"/>
<Dimension name="Date">
<Hierarchy hasAll="true" allMemberName="All Date">
<Level name="Date" column="date" uniqueMembers="true"/>
</Hierarchy>
</Dimension>
<Dimension name="Machine">
<Hierarchy hasAll="true" allMemberName="All Machine">
<Level name="Machine" column="machine" uniqueMembers="true"/>
</Hierarchy>
</Dimension>
<Dimension name="Level">
<Hierarchy hasAll="true" allMemberName="All Level">
<Level name="Level" column="level" uniqueMembers="true"/>
</Hierarchy>
</Dimension>
<Dimension name="Item">
<Hierarchy hasAll="true" allMemberName="All Item">
<Level name="Item" column="item" uniqueMembers="true"/>
</Hierarchy>
</Dimension>
<Dimension name="Code">
<Hierarchy hasAll="true" allMemberName="All Code">
<Level name="Code" column="code" uniqueMembers="true"/>
</Hierarchy>
</Dimension>
<Dimension name="Comment">
<Hierarchy hasAll="true" allMemberName="All">
<Level name="Comment" column="comment" uniqueMembers="true"/>
</Hierarchy>
</Dimension>
<Measure name="Downtime" column="downtime" aggregator="sum" formatString="Standard" visible="true"/>
</Cube>
</Schema>
My query looks like follows:
{[Item].[All Item]} * {[Measures].[Downtime]}
ON columns,
{[Code].[All Code]} * {[Comment].[All Comment]}
ON rows
from [ExampleCube]
WHERE
{([Date].[2011-11-31], [Machine].[1500], [Level].[AB])}
It works, but I want to have measures not for a single date, but for a period of time (from the start date till the end date).
Try using the range operator :
{[Item].[All Item]} * {[Measures].[Downtime]}
ON columns,
{[Code].[All Code]} * {[Comment].[All Comment]}
ON rows
from [ExampleCube]
WHERE
(
{[Date].[2011-11-31]:[Date].[2015-06-25]}
, [Machine].[1500], [Level].[AB]
)
Both dates [Date].[2011-11-31]:[Date].[2015-06-25] must exist within your cube.
I have the following table created by the following MDX
SELECT
{
[Measures].numTickets
}ON COLUMNS,
{
Descendants(DateCreacion.Children, DateCreacion.Month)
}ON ROWS
FROM tickets
The thing is that i want to add another column to the numTickets but every time i add a dimension to the column, i get an empty column.
select {[Clinica].Children} ON COLUMNS,
{Descendants([DateCreacion].Children, [DateCreacion.YQMD].[Month])} ON ROWS
from [tickets]
How would i show the same data as the first picture but in the second format?
<Schema name="New Schema1">
<Cube name="tickets" visible="true" cache="true" enabled="true">
<Table name="fact">
</Table>
<Dimension type="TimeDimension" visible="true" foreignKey="fecha_tickets_id" name="DateCreacion">
<Hierarchy name="YQMD" visible="true" hasAll="true">
<Table name="dim_fecha_creacion_tickets" alias="">
</Table>
<Level name="Year" visible="true" column="año" type="Numeric" uniqueMembers="false" levelType="TimeYears">
</Level>
<Level name="Quarter" visible="true" column="cuarto" type="Numeric" uniqueMembers="false" levelType="TimeQuarters">
</Level>
<Level name="Month" visible="true" column="mes" type="Numeric" uniqueMembers="false" levelType="TimeMonths">
</Level>
<Level name="Day" visible="true" column="dia" type="Numeric" uniqueMembers="false" levelType="TimeDays">
<Property name="date_iso" column="date_iso" type="Numeric">
</Property>
</Level>
</Hierarchy>
</Dimension>
<Dimension type="StandardDimension" visible="true" foreignKey="clinica_id" name="Clinica">
<Hierarchy name="New Hierarchy 0" visible="true" hasAll="true">
<Table name="dim_posicion" alias="">
</Table>
<Level name="Posicion" visible="true" column="sigla" type="String" uniqueMembers="false">
</Level>
</Hierarchy>
</Dimension>
<Measure name="numTickets" column="idTicket" datatype="Numeric" aggregator="count" visible="true">
</Measure>
</Cube>
</Schema>
When adding the [Clinica].Children to the columns, you removed the measures.
You probably want to keep them, using a cross join, which can be stated using the * operator in MDX: Either
select {[Clinica].Children}
*
{ [Measures].numTickets }
ON COLUMNS,
...
or
select { [Measures].numTickets }
*
{[Clinica].Children}
ON COLUMNS,
...
depending on the order of columns you want to see.