结合使用saiku、mondrian workbentch建立多维查询报表
2016-02-21 22:03
387 查看
原文链接:https://www.geek-share.com/detail/2667063380.html
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,上传模式文件即可
如果如图:
转载于:https://www.cnblogs.com/liqiu/p/5205687.html
相关文章推荐
- 结合使用saiku、mondrian workbentch建立多维查询报表
- 使用brio连接Sql Server 2000建立多维查询OLAP
- 使用 Apache Phoenix and HBase 结合 saiku 做大数据查询分析
- ActiveReport 使用心得(二):建立报表文件及中文显示的问题
- Access使用查询--1.1. 用选择查询建立计算字段
- 思达报表工具Style Report基础教程—在查询条件中使用变量
- 在 Access 里使用查询建立 存储过程/视图, 并使用 ASP 执行
- jqGrid与Struts2的结合应用(六) —— 使用colModel设置查询功能
- 建立一个更高级别的查询 API:正确使用Django ORM 的方式
- centos7.3 docker registry(使用版本 2.6.1) 私有仓库 建立 查询 删除(未成功删除文件和元数据,好像是实际当前官方版本不支持) 回收垃圾(未成功,好像是实际当前官方版本不支持) 安全认证(仅限用户名密码)
- [转贴]使用 Excel Services ,结合 Analysis Services 在 SharePoint 中发布报表
- 即时报表中查询条件的使用
- CTE和WITH AS短语结合使用提高SQL查询性能
- Pentaho多维分析(Mondrian)使用指南
- 思达报表工具Style Report基础教程—在手工输入的SQL查询中使用可替换字符串型变量
- 建立字典嵌套,使用get()查询.
- 使用Future接口进行多线程报表查询
- Kylin系列-使用Saiku+Kylin构建多维分析OLAP平台
- LINQ下使用三层架构的探索(四)建立一个逻辑访问层,并且添加一些查询方法
- 如何建立基于SSAS的Reporting Services报表,以及参数(parameters)使用