BookmarkSubscribeRSS Feed
HorneC
Calcite | Level 5

Infinite Recursion Error.png

 

I am trying to create a calculated member in my SAS OLAP cube using some conditional logic. In summary I need the member to abide by the following logic. If the prof product is ALLPP then return the amount associated with TC, if not look to see if the prof product id rolls up to TC. If it does, return the amount associated with the current member. If not, return 0.

 

Below is a quick summary of the prof product dimension.

 

Parent        Child

#root          ALLPP

ALLPP       TC

ALLPP       NP

TC              RC

TC              CC

 

What I need to do is exclude NP from the member being returned. If there is a better way to accomplish this, I am certainly open to suggestions.

 

Here is the code I have so far. &Cube_Name and &CM return the MDX path for where my test member should sit.

 

Thank you in advance!

 

	/*146*/ DEFINE MEMBER "[&Cube_Name.].&CM..[Provision_Stat_Test]" AS
				" (iif(([Prof_Product].CurrentMember = [Prof_Product].[All Profitability Products].[ALLPP]),
				  ([Account].[All Account].[All_Accounts].[IS_Accounts].[NetInc].[PreTaxInc_TE].[NetIntInc_NP_TE].[Provision].[Provision_PM].[Prov_byCalc],[Prof_Product].[All Profitability Products].[ALLPP].[TC]),
				  (iif((Ancestor([Prof_Product].CurrentMember,[Prof_Product].[Lev02_Prof_Product]) = [Prof_Product].[All Profitability Products].[ALLPP].[TC]),
				  ([Account].[All Account].[All_Accounts].[IS_Accounts].[NetInc].[PreTaxInc_TE].[NetIntInc_NP_TE].[Provision].[Provision_PM].[Prov_byCalc],[Prof_Product].CurrentMember),
				  0))
				* (-1))
				, SOLVE_ORDER=5";
2 REPLIES 2
HorneC
Calcite | Level 5

I did not see that. I am not sure if that is causing my problem as I am running my code in SAS EG, but I will check with my admin. Thank you!!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 837 views
  • 0 likes
  • 2 in conversation