Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试编写一个 olap4j (Mondrian) 查询,该查询将按范围对行进行分组。假设我们计算了每个孩子的卡片数量和孩子的年龄。我想按年龄范围对卡的金额求和,所以我将计算 0-5,5-10,10-15 等年龄段的人数。这可以用 olap4j 完成吗?
您需要为此定义计算成员:
With member [Age].[0-4] as [Age].[0]:[Age].[4] member [Age].[5-9] as [Age].[5]:[Age].[9]
等等
或者,您可能想要重新设计维度表。我猜你的年龄是事实表中的退化维度。我建议使用如下结构创建一个单独的维度 dim_age:
age_id, age, age_group 0, null, null 1, 0, 0-4 2, 1, 0-4 (...)
然后很容易根据age_group在维度上定义第一层。