我使用的版本是mondrian4,saiku3.15,mysql5.7
可以看到是有两行isNoLink不同而approve相同的行被错误合并了
根据我自查,除了时间维度,其它维度中只有层次的(Schema文件定义level顺序上)第一个级别作为行列查询能出现正确结果。
无论查询中有几个行或者列,只要查询中添加了至少一个层次的(Schema文件定义level顺序上)非第一级别,就一定会出现错误重复行和数据。
反之如果行列都是层次的(Schema文件定义level顺序上)第一级别,那么能得到正确的数据
网上关于mondrian4的资料真的很少,所以没办法只能自己摸索写mondrian4 schema文件,如下
<?xml version="1.0" encoding="UTF-8"?>
<Schema name="zctag_schema" metamodelVersion="4.0" xsi:noNamespaceSchemaLocation="mondrian4.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<PhysicalSchema>
<Table name="orders" keyColumn="proWoCode" />
<Table name="appOrg" keyColumn="proWoCode" />
<Table name="time" keyColumn="proWoCode" />
<Table name="type" keyColumn="proWoCode" />
<Table name="condition" keyColumn="proWoCode" />
<Link source="appOrg" foreignKeyColumn="proWoCode" target="orders" />
<Link source="time" foreignKeyColumn="proWoCode" target="orders" />
<Link source="type" foreignKeyColumn="proWoCode" target="orders" />
<Link source="condition" foreignKeyColumn="proWoCode" target="orders" />
</PhysicalSchema>
<Cube name="zctag_cube">
<Dimensions>
<Dimension name="stateTime_Dimension" caption="完成时间" table="time" key="proWoCode" type="TIME">
<Attributes>
<Attribute name="proWoCode" table="time" keyColumn="proWoCode" hasHierarchy="false" />
<Attribute name="year" table="time" keyColumn="year" hasHierarchy="false" />
<Attribute name="month" table="time" keyColumn="month" hasHierarchy="false" />
<Attribute name="day" table="time" keyColumn="day" hasHierarchy="false" />
</Attributes>
<Hierarchies>
<Hierarchy name="stateTime_Hierarchy"
caption="时间轴"
allMemberName="all stateTime_Hierarchy" allMemberCaption="所有时间" hasAll="true">
<Level attribute="year"
caption="年份" />
<Level attribute="month"
caption="月份" />
<Level attribute="day"
caption="日期" />
</Hierarchy>
</Hierarchies>
</Dimension>
<Dimension name="appOrg_Dimension" caption="承办单位" table="appOrg" key="proWoCode">
<Attributes>
<Attribute name="proWoCode" table="appOrg" keyColumn="proWoCode" hasHierarchy="false" />
<Attribute name="appOrgName" table="appOrg" keyColumn="appOrgName" hasHierarchy="false" />
</Attributes>
<Hierarchies>
<Hierarchy name="appOrg_Hierarachy"
caption="单位信息" allMemberName="all appOrg_Hierarchy"
allMemberCaption="所有单位信息" hasAll="true">
<Level attribute="appOrgName" caption="单位名字" />
</Hierarchy>
</Hierarchies>
</Dimension>
<Dimension name="type_Dimension" caption="分类" table="type" key="proWoCode">
<Attributes>
<Attribute name="proWoCode" table="type" keyColumn="proWoCode" hasHierarchy="false" />
<Attribute name="type" table="type" keyColumn="type" hasHierarchy="false" />
<Attribute name="classify" table="type" keyColumn="classify" hasHierarchy="false" />
<Attribute name="firstActName" table="type" keyColumn="firstActName" hasHierarchy="false" />
<Attribute name="secondActName" table="type" keyColumn="secondActName" hasHierarchy="false" />
<Attribute name="thirdActName" table="type" keyColumn="thirdActName" hasHierarchy="false" />
</Attributes>
<Hierarchies>
<Hierarchy name="type_Hierarchy" caption="详细分类"
allMemberName="all type_Hierarchy" allMemberCaption="所有分类" hasAll="true">
<Level attribute="type" caption="类型" />
<Level attribute="classify" caption="类别" />
<Level attribute="firstActName" caption="问题一级分类" />
<Level attribute="secondActName" caption="问题二级分类" />
<Level attribute="thirdActName" caption="问题三级分类" />
</Hierarchy>
</Hierarchies>
</Dimension>
<Dimension name="condition_Dimension" caption="完成情况" table="condition" key="proWoCode">
<Attributes>
<Attribute name="proWoCode" table="condition" keyColumn="proWoCode" hasHierarchy="false" />
<Attribute name="isNoLink" table="condition" keyColumn="isNoLink" hasHierarchy="false" />
<Attribute name="approve" table="condition" keyColumn="approve" hasHierarchy="false" />
</Attributes>
<Hierarchies>
<Hierarchy name="condition_Hierarchy" caption="详细状况"
allMemberName="all condition_Hierarchy" allMemberCaption="所有情况" hasAll="true">
<Level attribute="isNoLink" caption="回访情况" />
<Level attribute="approve" caption="满意情况" />
</Hierarchy>
</Hierarchies>
</Dimension>
</Dimensions>
<MeasureGroups>
<MeasureGroup name="orders" table="orders">
<Measures>
<Measure name="count" caption="总数量" column="proWoCode" aggregator="distinct-count" datatype="Integer"/>
<Measure name="avgDotime" caption="平均办理时长" column="dotime" aggregator="avg" datatype="String" />
</Measures>
<DimensionLinks>
<ForeignKeyLink dimension="stateTime_Dimension" foreignKeyColumn="proWoCode" />
<ForeignKeyLink dimension="appOrg_Dimension" foreignKeyColumn="proWoCode" />
<ForeignKeyLink dimension="type_Dimension" foreignKeyColumn="proWoCode" />
<ForeignKeyLink dimension="condition_Dimension" foreignKeyColumn="proWoCode" />
</DimensionLinks>
</MeasureGroup>
</MeasureGroups>
</Cube>
</Schema>
这个问题我百度谷歌找了好久也没有找到类似的问题,再加上saiku,mondrian4资料又少,真是无能为力了,请大佬们不吝赐教