MDX for retrieving cube value in SubsetToSet

Post Reply
CRP0021
Posts: 35
Joined: Mon Aug 21, 2017 2:14 pm
OLAP Product: TM1
Version: 10.3
Excel Version: 2016

MDX for retrieving cube value in SubsetToSet

Post by CRP0021 »

Hi all,

Just need some assistance in writing an MDX statement to pull in a cube value and pass it in to the function TM1SubsetToSet.

Here are some details:
-Dimension name is Location
-Lookup cube name is User Settings
-Measure trying to retrieve subset name from is Location_Subset_Name

I can get the function TM1 SubsetToSet function to work when I hard-code the location name:

TM1SubsetToSet ( [Location].[Location] , "New_Location" , "public")

And I tried wrapping this insdie the TM1SubsetToSet but I'm not having any luck:
StrToMember( "[Location].[" + CoalesceEmpty( [User Settings].(StrToMember( "[}Clients].[" + UserName + "]"), [User Settings].[Location_Subset_Name]), "<default>" ) + "]"),

My end goal is to have the name of the subset which changes by user be dynamically set in the Location dim with the TM1SubsetToSet function

Any advice would be much appreciated!
Attachments
Screenshot_1.png
Screenshot_1.png (9.94 KiB) Viewed 1670 times
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 for retrieving cube value in SubsetToSet

Post by burnstripe »

Try this:

Code: Select all

TM1SubsetToSet (
	[Location].[Location] 
	, "" + [User Settings].(StrToMember( "[}Clients].[" + UserName + "]"), [User Settings].[Location_Subset_Name]) + "" 
	, "public")
CRP0021
Posts: 35
Joined: Mon Aug 21, 2017 2:14 pm
OLAP Product: TM1
Version: 10.3
Excel Version: 2016

Re: MDX for retrieving cube value in SubsetToSet

Post by CRP0021 »

That did the trick thank you!
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 for retrieving cube value in SubsetToSet

Post by Wim Gielis »

I think that you can remove "" + and + "" unless Burnstripe is sure they are needed ?
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
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 for retrieving cube value in SubsetToSet

Post by burnstripe »

Wim Gielis wrote: Wed Nov 20, 2024 1:39 am I think that you can remove "" + and + "" unless Burnstripe is sure they are needed ?
They were needed for passing the subset name within the tm1subsettoset

With the "" it returns as this and works
TM1SubsetToSet ([Location].[Location] , "my subset" , "public")

Without the "" it returns as this and fails
TM1SubsetToSet ([Location].[Location] , my subset , "public")
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 for retrieving cube value in SubsetToSet

Post by Wim Gielis »

burnstripe wrote: Wed Nov 20, 2024 7:29 pm
Wim Gielis wrote: Wed Nov 20, 2024 1:39 am I think that you can remove "" + and + "" unless Burnstripe is sure they are needed ?
They were needed for passing the subset name within the tm1subsettoset

With the "" it returns as this and works
TM1SubsetToSet ([Location].[Location] , "my subset" , "public")

Without the "" it returns as this and fails
TM1SubsetToSet ([Location].[Location] , my subset , "public")
I see what is happening. I removed them, but then PAW put them there. So yes they are needed. Solved :-)
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
Post Reply