To achieve this you would first need to store in the TM1 model the elements which should be displayed. You would normally do this by creating an attribute in the Account dimesion. For argument’s sake let’s assume that this attribute is called “Show” and contains the value “Show” when an element should be displayed in your use case.
The problem is combining both these statements as both IIF and CASE/THEN/ELSE in MDX can only return objects or values and NOT members or sets. Maybe some brainiac can solve this with pure MDX. However, you could solve this by having a 2nd attribute in the Account dimension called “MDXDrill” in addition to “Show”.
Against the MDXDrill attribute against each account element you would store a string exactly as the 1st case above against “Total Prime Cost” and the 2nd case against all other elements. (Maybe for leaves you might want to change it to just {[Account].[Account].[$<<tm1.Account.Account>>]} as .children would return empty. Then against the Account dimension on rows (not filter) you would just make the list type “MDX” and the MDX would sumply be $<<tm1.Account.Account::MDXDrill>> As you can nest setting service variables within each other this should work just fine and achieve what you want it to.
I already said one way to make this work. Please do the training! It is all online and available to you.Training Materials - Apliqo UX Documentation - Confluence literally all you need to do this is the demo application which can be installed automatically by the installer. Think of it as an investment.
Provided you explained the requirements correctly then exactly what is below is the setup which you would need.