How to Apply group by on mdx Query

拈花ヽ惹草 提交于 2019-12-25 00:50:01

问题


Working pentaho dashboard trying to generate report to get transaction count per day/Week/Month between two date.

Below MDX Query return transaction count 1 because 'created' is not group by

WITH
SET [~COLUMNS] AS Filter([created].DefaultMember.Children, [created].CurrentMember.name >= "2014-10-01" AND Left([created].CurrentMember.Name, 10) <= "2014-10-02")
SET [~ROWS] AS
    {[markup].[markup].Members}
SELECT
NON EMPTY CrossJoin([~COLUMNS], {[Measures].[Transaction Count]}) ON COLUMNS,
NON EMPTY [~ROWS] ON ROWS
FROM [transaction]

How to i can group column '[created]'


回答1:


Why not just move the measure into the WHERE clause:

WITH
SET [~COLUMNS] AS Filter([created].DefaultMember.Children, [created].CurrentMember.name >= "2014-10-01" AND Left([created].CurrentMember.Name, 10) <= "2014-10-02")
SET [~ROWS] AS
    {[markup].[markup].Members}
SELECT
NON EMPTY [~COLUMNS] ON COLUMNS,
NON EMPTY [~ROWS] ON ROWS
FROM [transaction]
WHERE [Measures].[Transaction Count]


来源:https://stackoverflow.com/questions/48204929/how-to-apply-group-by-on-mdx-query

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!