SSAS Actions IF statement

  • Hi All

    Great forum. I have just joined. Hoping someone can help me please.

    I have created an Action in SSAS 2014 that can be used to navigate to a URL from within Excel when browsing a cube. It uses MDX. I know very little MDX but managed to get it working.

    Here is the code

    "https://my346449-sso.crm.ondemand.com/sap/public/b...="

    + [dash sap crm Visits].[sap link visit].currentmember.member_caption

    + "&param.Type=COD_VISIT_TT&sapbyd-agent=TAB"

    The problem I have is that the sap_link_visit field I pass to the URL can contain a code for either visits or phone calls. These both have different URLS. I need to write an IF statement so that if the visit_type is phone_call it uses one URL and if the visit_type is a visit it uses another. In simple english this is what I am trying to do..........

    IF visit_type = 'visit'

    THEN

    "https://my346449-sso.crm.ondemand.com/sap/public/b...="

    + [dash sap crm Visits].[sap link visit].currentmember.member_caption

    + "&param.Type=COD_VISIT_TT&sapbyd-agent=TAB"

    ELSE IF visit_type = 'phone call'

    THEN

    "https://my346449-sso.crm.ondemand.com/sap/public/b...="

    + [dash sap crm Visits].[sap link visit].currentmember.member_caption + "&param.Type=COD_PHONECALL&sapbyd-agent=TAB"

    I have created a work around that simply uses 2 different Actions but this is not ideal as it requires the end user to know that the are looking at a visit record or a phone call record.

    Hope someone can help and thank you

    Nick

  • I've not done something like this (we don't use SSAS or MDX at our shop), but it sounds like a good use case for CASE:

    https://docs.microsoft.com/en-us/sql/mdx/case-statement-mdx?view=sql-server-ver15

    The above is all just my opinion on what you should do. 
    As with all advice you find on a random internet forum - you shouldn't blindly follow it.  Always test on a test server to see if there is negative side effects before making changes to live!
    I recommend you NEVER run "random code" you found online on any system you care about UNLESS you understand and can verify the code OR you don't care if the code trashes your system.

  • Hi

    Thank you for the reply.  I was search for help with IF statements.  Didn't realise you could use CASE in MDX.

    I will give it a go

    Thanks

    Nick

  • I tried this but couldn't get it working.  Can any one help please

    with member [x] as

    CASE

    WHEN [dash sap crm Visits].[visit type].currentmember.member_value = 'phone call'

    THEN

    "https://my346449-sso.crm.ondemand.com/sap/public/byd/runtime?bo_ns=http://sap.com/thingTypes&bo=COD_GENERIC&node=Root&operation=OnExtInspect&param.InternalID="

    + [dash sap crm Visits].[sap link visit].currentmember.member_caption

    + "&param.Type=COD_PHONECALL&sapbyd-agent=TAB"

    ELSE

    "https://my346449-sso.crm.ondemand.com/sap/public/byd/runtime?bo_ns=http://sap.com/thingTypes&bo=COD_GENERIC&node=Root&operation=OnExtInspect&param.InternalID="

    + [dash sap crm visits].[sap link account].currentmember.member_caption

    + "&param.Type=COD_ACCOUNT_TT&sapbyd-agent=TAB"

     

    Thanks

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply