结合使用saiku、mondrian workbentch建立多维查询报表
1、简介
前几篇博客已经介绍了saiku、mondrian、MDX和模式文件他们之间的关系,那么如何将它们串联起来,供产品人员使用哪?下面咱们一步一步的实现
2、建立数据表
建表语句参考:http://www.cnblogs.com/liqiu/p/5202708.html
模式图如下:

这是一个典型的事实表+维度表的星型数据结构!
3、建立模式文件
这里就不说具体细节啦,直接给出xml文件内容,感兴趣的同学可以直接载入进去即可
<Schema name="SaleSchema">
<Cube name="SalesCube" visible="true" cache="true" enabled="true">
<Table name="sale" schema="public">
</Table>
<Dimension type="StandardDimension" visible="true" foreignKey="cusid" highCardinality="false" name="dimCustomer">
<Hierarchy visible="true" hasAll="true" allMemberName="allCustomer" primaryKey="cusid">
<Table name="customer" schema="public">
</Table>
<Level name="gender" visible="true" column="gender" type="String" uniqueMembers="true" levelType="Regular" hideMemberIf="Never">
</Level>
</Hierarchy>
</Dimension>
<Dimension type="StandardDimension" visible="true" foreignKey="proid" highCardinality="false" name="dimProductType">
<Hierarchy visible="true" hasAll="true" allMemberName="allProduct" allMemberCaption="allProductTitle" primaryKey="proid" primaryKeyTable="product">
<Join leftKey="proid" rightKey="protypeid">
<Table name="product" schema="public">
</Table>
<Table name="producttype" schema="public">
</Table>
</Join>
<Level name="productId" visible="true" table="product" column="proid" nameColumn="proname" type="String" uniqueMembers="true" levelType="Regular" hideMemberIf="Never">
</Level>
<Level name="productTypeId" visible="true" table="producttype" column="protypeid" nameColumn="protypename" type="String" uniqueMembers="true" levelType="Regular" hideMemberIf="Never">
</Level>
</Hierarchy>
</Dimension>
<Measure name="saleNumber" column="num" aggregator="sum" caption="NumTitle" visible="true">
</Measure>
<Measure name="saleAmount" aggregator="sum" caption="allSaleTitle" visible="true">
<MeasureExpression>
<SQL dialect="generic">
<![CDATA[(unitprice*num)]]>
</SQL>
</MeasureExpression>
</Measure>
<CalculatedMember name="avgPrice" caption="avgPriceTitle" dimension="Measures" visible="true">
<Formula>
<![CDATA[[Measures].saleAmount/[Measures].saleNumber]]>
</Formula>
<CalculatedMemberProperty name="formatString" value="$#,##0.00">
</CalculatedMemberProperty>
</CalculatedMember>
</Cube>
</Schema>
4、查询数据
写如下MDX语句验证数据准确性
select
{[Measures].saleNumber,[Measures].saleAmount,[Measures].avgPrice}
on columns,
{([dimProductType].[allProduct],[dimCustomer].[allCustomer])}
on rows
from [salesCube]
结果如下:

5、上传模式文件
打开saiku,上传模式文件即可
如果如图:

结合使用saiku、mondrian workbentch建立多维查询报表的更多相关文章
- 在Python中建立N维数组并赋初值
在Python中,由于不像C++/Java这样的语言可以方便的用a[i][j]=0的方式,建立二维数组并赋初值,所以需要一个相对巧妙的方法. 可以用列表解析的方式,eg: >>> m ...
- 如何在C++中动态建立二维数组(转)
http://blog.sina.com.cn/s/blog_7c073a8d0100qp1w.html http://blog.163.com/wujiaxing009@126/blog/stati ...
- python 建立多维列表
今天用到在网上没有找到合适的思路,于是自己动手写了一个,作为记录. dpa = [] dpb = [] dpc = [] for i in range(21): dpa.append(0) for i ...
- Saiku对Measure(指标)查询结果进行计算后显示的方法
在通过Saiku查询数据的时候,当需要改变查询结果的显示方式的时候,可以添加formatString属性,但是当需要计算查询结果的时候,则需要使用CellFormatter,使用方法如下: <M ...
- 教你用plsql建立索引加快查询oracle数据的速度
http://jingyan.baidu.com/article/3f16e003cb9a0f2591c10324.html?qq-pf-to=pcqq.c2c PL/SQL Developer是一个 ...
- sqlite优化记录:建立索引加快查询速度
凡是数据库中,索引的存在就是为了提高查询速度的,数据库的索引有点类似于书本上面的目录的概念,因为在英文中都是index,事实上也就是目录. 其算法应该叫做“倒排索引”,这个其实也类似于搜索引擎里面的基 ...
- Day4 数据库的建立||数据库对外查询||使用命令行来操作数据库
###数据库的创建 建立一个项目 先进行测试,测试新项目是否可以成功运行 创建一个PersonContrary包,并建立一个Person类实现BaseColumns借口,在此类中添加所有的表的列名,并 ...
- SQL 建立临时表进行查询
SELECT min (maxrank) as minofmaxrank FROM (SELECT max(rank) as maxrank FROM tbl_core_staff WHERE st_ ...
- map对象建立家族姓氏查询
题目:定义一个map对象,其元素的键是家族姓氏,而值是存储该家族孩子名字的vector对象.为这个map容器输入至少六个条目.通过基于家族姓氏的查询检测你的程序,查询应输出该家族所有孩子的名字. // ...
随机推荐
- [51单片机] EEPROM 24c02 [读取存储多字节]
先将数据存进去,然后再读出来显示在数码管上. 除了代码里定义的连线外还要把p0连接到8位数码管的8针上. /*--------------------------------------------- ...
- 说不尽的MVVM(5) - 消息满天飞
知识预备 阅读本文,我假定你具备以下知识: C#和WPF基础知识 Lambda表达式 清楚ViewModel的职责 如果我们的程序需要弹出一个MessageBox,我们应该怎么做? 我见过不少人在Vi ...
- iOS UITableView中点击状态栏无法回滚到顶部
// When the user taps the status bar, the scroll view beneath the touch which is closest to the stat ...
- 【转】关于KDD Cup '99 数据集的警告,希望从事相关工作的伙伴注意
Features From: Terry Brugger Date: 15 Sep 2007 Subject: KDD Cup '99 dataset (Network Intrusion) cons ...
- paip.cache 缓存架构以及性能提升总结
paip.cache 缓存架构以及性能提升总结 1 缓存架构以及性能(贯穿读出式(LookThrough) 旁路读出式(LookAside) 写穿式(WriteThrough) 回写式 ...
- EntityFramework 4/5/6 中执行自定义SQL语句
参考:http://www.cnblogs.com/chengxiaohui/articles/2092001.html 在EF4(.NET 4)中,我们有了全新的API:ObjectContext ...
- 安装 Autoconf 2.69版
发生错误configure.ac:8: error: Autoconf version 2.64 or higher is required 1.检查版本 [root@localhost Deskto ...
- QT210 Android4.0源码编译和烧录文档整理
开发环境说明: Ubuntu 12.04 LTS 32bit 源码文件目录: 勤研光盘2013-5-4\4.0 https://github.com/jackyh (建议在Linux环境下通过git下 ...
- GRIDVIEW多行多列合并单元格(合并列)
GitHub项目地址:https://github.com/mingceng/merge-gridviewcell 去年的时候,我写了两篇文章: GridView多行多列合并单元格(完整代码和例子) ...
- 如何开发Domino中的WebService
在domino中写webservice可以使用LotusScript,也可以使用java,由于LotusScript API提供的功能多数都是操作domino数据库中文档的,在web service中 ...