MDX to get all elements of a ParamCube

Post Reply
schlemiel29
Posts: 68
Joined: Tue May 08, 2012 8:29 am
OLAP Product: TM/1
Version: 11.8
Excel Version: Excel 365

MDX to get all elements of a ParamCube

Post by schlemiel29 »

I have a cube (}TM1Config_UserReportDimElements), where I store selections of the user. Because they can select multiple elements of a dimension, I have a dimension "}numbers" which only include number elements "1" ... "20". So I can store each element the user has has chosen in a list in the elements "1" ... "20" without holes.

Code: Select all

{
  FILTER(
    TM1SUBSETALL([}KW_N_Von]),
    SUM(
      {[}Numbers].[AllMembers]},
      IIF(
        [}TM1Config_UserReportDimElements].(
          StrToMember("[}Clients].[" + USERNAME + "]"),
          [}TM1Config_Reports].[R371],
          StrToMember("[}TM1Config_Dimensions].[}KW_N_Von]"),
          [}Numbers].CurrentMember,
          [}TM1Config_ReportDimElement].[Element]
        ) = [}KW_N_Von].CurrentMember,
        1,
        0
      )
    ) > 0
  )
}
Unfortunately this MDX does not return any element. It should return two elements, because I entered them in the slot for dimension "}KW_N_Von" in cube }TM1Config_UserReportDimElements. Any idea?
Wim Gielis
MVP
Posts: 3222
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.1.5
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: MDX to get all elements of a ParamCube

Post by Wim Gielis »

Can you break it down and test piece by piece ?
Also, inserting hardcoded text instead of functions can often lead to identifying the place(s) where it goes wrong.
Best regards,

Wim Gielis

IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
schlemiel29
Posts: 68
Joined: Tue May 08, 2012 8:29 am
OLAP Product: TM/1
Version: 11.8
Excel Version: Excel 365

Re: MDX to get all elements of a ParamCube

Post by schlemiel29 »

Yes, I already did. Example:

Code: Select all

{
  FILTER(
    TM1SUBSETALL([}KW_N_Von]),
    SUM(
      TM1SUBSETALL([}KW_N_Von]),
      IIF( 1 = 1, 1, 0 )
    ) > 0
  )
}
This also returns nothing. If I change "> 0" to "= 0" I get all elements. I have totally no clue!
burnstripe
Regular Participant
Posts: 226
Joined: Wed May 06, 2020 2:58 pm
OLAP Product: Planning Analytics
Version: 2.0.9
Excel Version: 2016

Re: MDX to get all elements of a ParamCube

Post by burnstripe »

I'll also add, the original query won't work as I'm guessing you are trying to run this in the subset editor for the dimension }kw_n_von

In that scenario the currentmember statement will only work on that dimension, it won't work on [}Numbers].Currentmember because it's not in context

You'd have to add each line number individually
schlemiel29
Posts: 68
Joined: Tue May 08, 2012 8:29 am
OLAP Product: TM/1
Version: 11.8
Excel Version: Excel 365

Re: MDX to get all elements of a ParamCube

Post by schlemiel29 »

OK, thanks. I realized that by simple try and error. So my solution is a cube with rules and then request that cube with checking values > 0. Unfortunatly I need a cube for every dimension with this filter feature.
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: MDX to get all elements of a ParamCube

Post by gtonkin »

Can you maybe post a spreadsheet example or some screenshots of what you have and what you expect, may be easier to assist.
BR, George.

Learn something new: MDX Views
Post Reply