How to use a parameter cube in PAW MDX

Post Reply
ice1000
Posts: 3
Joined: Fri Oct 08, 2021 4:12 pm
OLAP Product: TM1
Version: PAX on Cloud
Excel Version: O365

How to use a parameter cube in PAW MDX

Post by ice1000 »

I have a calculated member in a PAW view. Instead of hardcoding the values in the calculation I would like to retrieve the element name from a parameter cube. I can't figure out the correct syntax.

This is the MDX with the hardcoded values:

Code: Select all

WITH 
   MEMBER [Scenario].[Scenario].[Plan / Actuals] AS [Scenario].[Scenario].[Plan] / [Scenario].[Scenario].[Actuals], SOLVE_ORDER = 1, FORMAT_STRING = '#,##0.00;(#,##0.00)' 
SELECT 
   {
      [Period].[Period].[All Years^2020^2020Q2^202004]
   } ON 0, 
   {
      [Scenario].[Scenario].[Scenario Hierarchies^Actuals],
      [Scenario].[Scenario].[Scenario Hierarchies^Plan],
      [Scenario].[Scenario].[Plan / Actuals]
   } ON 1 
FROM
   [Finance] 
WHERE (
   [Finance_Msr].[Finance_Msr].[Original], 
   [Company].[Company].[001], 
   [Department].[Department].[Total Departments^Sales and Marketing^40], 
   [Currency].[Currency].[USD], 
   [Account].[Account].[Net Income After Allocations^Net Income^EBITDA^Gross Margin^Net Sales^Sales^410000])
I want the denominator of

Code: Select all

MEMBER [Scenario].[Scenario].[Plan / Actuals] AS [Scenario].[Scenario].[Plan] / [Scenario].[Scenario].[Actuals]
to be retrieved from a cube. The cube will have the name of the scenario as a string data point.

I've tried this and I get ERROR in the cube (MDX compiles but I see the word ERROR in the data point):

Code: Select all

            (
                [Control].[Control Parameter].[Target Scenario],
                [Controls].[Measure].[String]
            )
I created a dynamic subset that returns the correct scenario using a rule-based attribute. Then I tried this:

Code: Select all

STRTOMEMBER("[Scenario].[Scenario].[" + SETTOSTR( TM1SubsetToSet([Scenario].[Scenario] , "TargetScenarioSubset" , "public")) + "]")
That also results in an ERROR value.

How can I do this?
ice1000
Posts: 3
Joined: Fri Oct 08, 2021 4:12 pm
OLAP Product: TM1
Version: PAX on Cloud
Excel Version: O365

Re: How to use a parameter cube in PAW MDX

Post by ice1000 »

For posterity, I got these two to work. I do want to get the TM1SUBSETTOSET to work. Still testing that one.

Code: Select all

STRTOMEMBER("[Scenario].[Scenario].["+LOOKUPCUBE( "Control","([Control Parameter].[Control Parameter].[Target Scenario],[Control Measure].[Control Measure].[String])" )+"]")

STRTOMEMBER("[Scenario].[Scenario].["+[Control].([Control Parameter].[Control Parameter].[Target Scenario],[Control Measure].[Control Measure].[String])+"]")
User avatar
gtonkin
MVP
Posts: 1254
Joined: Thu May 06, 2010 3:03 pm
OLAP Product: TM1
Version: Latest and greatest
Excel Version: Office 365 64-bit
Location: JHB, South Africa
Contact:

Re: How to use a parameter cube in PAW MDX

Post by gtonkin »

Try Part 7 of my Introduction to MDX for more insights...
BR, George.

Learn something new: MDX Views
User avatar
gtonkin
MVP
Posts: 1254
Joined: Thu May 06, 2010 3:03 pm
OLAP Product: TM1
Version: Latest and greatest
Excel Version: Office 365 64-bit
Location: JHB, South Africa
Contact:

Re: How to use a parameter cube in PAW MDX

Post by gtonkin »

To get a member from the subset try something this:

Code: Select all

{
TM1SubsetToSet([Scenario] , "Default").ITEM(0).ITEM(0)
}
That should return the first member.

Code: Select all

{
TM1SubsetToSet([Scenario] , "Default").ITEM(1).ITEM(0)
}
Will return the second member.
BR, George.

Learn something new: MDX Views
Post Reply