Uploaded image for project: 'Pentaho Analysis - Mondrian'
  1. Pentaho Analysis - Mondrian
  2. MONDRIAN-1095

Tuple evaluation in calculated measures is wrong when using set with several tuples in WHERE clause

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Severity: Urgent
    • Resolution: Fixed
    • Affects Version/s: 3.4.1 GA (4.5.0 GA Suite Release)
    • Fix Version/s: 5.4.0 GA
    • Component/s: None
    • Labels:
      None
    • Notice:
      When an issue is open, the "Fix Version/s" field conveys a target, not necessarily a commitment. When an issue is closed, the "Fix Version/s" field conveys the version that the issue was fixed in.

      Description

      Got this bug both in Mondrian 3.3.0 as well as using the latest Mondrian 3.4 snapshot build from http://ci.pentaho.com/job/mondrian-git/31/

      When using FoodMart schema the following MDX query returns correct result for [Measures].[Food Sales] calculated measure:

      WITH MEMBER [Measures].[Food Sales] AS '([Measures].[Store Sales], [Product].[Food])'
      SELECT {[Measures].[Store Sales], [Measures].[Food Sales]} ON COLUMNS,
      [Customers].DefaultMember ON ROWS
      FROM [Sales]
      WHERE ([Product].[All Products], [Time].[1997])
      

      But when set with several tuples is used in WHERE clause:

      WITH MEMBER [Measures].[Food Sales] AS '([Measures].[Store Sales], [Product].[Food])'
      SELECT {[Measures].[Store Sales], [Measures].[Food Sales]} ON COLUMNS,
      [Customers].DefaultMember ON ROWS
      FROM [Sales]
      WHERE CROSSJOIN({[Product].[All Products]}, [Time].[1997].Children)
      

      then [Measures].[Food Sales] value is wrong and is equal to total [Measures].[Store Sales] value.

      When just one tuple is returned by CROSSJOIN in WHERE clause then [Measures].[Food Sales] is again correct:

      WITH MEMBER [Measures].[Food Sales] AS '([Measures].[Store Sales], [Product].[Food])'
      SELECT {[Measures].[Store Sales], [Measures].[Food Sales]} ON COLUMNS,
      [Customers].DefaultMember ON ROWS
      FROM [Sales]
      WHERE CROSSJOIN({[Product].[All Products]}, {[Time].[1997]})
      

      Currently I found one workaround how to get result what I need (to be able to use set of several dimension members in WHERE clause) - I have to dynamically define calculated aggregated member for set and then use simple tuple in WHERE clause:

      WITH MEMBER [Measures].[Food Sales] AS '([Measures].[Store Sales], [Product].[Food])'
         MEMBER [Time].[Aggregate] AS 'Aggregate([Time].[1997].Children)'
      SELECT {[Measures].[Store Sales], [Measures].[Food Sales]} ON COLUMNS,
      [Customers].DefaultMember ON ROWS
      FROM [Sales]
      WHERE ([Product].[All Products], [Time].[Aggregate])
      

      In this case [Measures].[Food Sales] value is correct.

        PractiTest Integration




          Attachments

            Issue Links

              Activity

                People

                Assignee:
                Unassigned Unassigned
                Reporter:
                raimonds.simanovskis Raimonds Simanovskis
                Votes:
                4 Vote for this issue
                Watchers:
                8 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: