Skip to Content

SAP PCM - Rule Editing Formula for ActivityDriverValue

Hello, I'm hoping someone can help me out! I'm working on writing a rule and I see how it's working, but it's not working how I would like. Between items A and B, I'm trying to come up with a factor based on selected customers that are in the A or B groups. Right now, the following code will sum ALL members under A and ALL members under B. I really only want the sum of members under A / B for those that are selected in allocations.

Hopefully that makes sense. I have a note in the sample code. The math is working and is pretty much doing what I want, I just can't get the right method for A_members and B_members.

Here is my current code:

Function CellValue

RestrictDimension("Cost Centers","RC Unassigned")
RestrictDimensionParent("Customers","A")
RestrictDimensionParent("Customers","B")
RestrictReturnZero

Dim A_members
Dim B_members
Dim total_members

Dim A_factor
Dim B_factor

Dim A_desired_percent
Dim B_desired_percent

A_desired_percent = 0.9
B_desired_percent = 1 - A_desired_percent

' THIS IS WHERE I NEED HELP!

' I want a formula that will sum ALL members where customer, business and product is selected

' if I leave blank, I don't get the desired information

' need something like ActivityDriverValue(,,,"Total Members",[selected customers under A or B],[selected businesses],[selected products])

' current formula selects all members whether the customer is selected or not
A_members = ActivityDriverValue(,,,"Total Members","A","Total Business","All Products")
B_members = ActivityDriverValue(,,,"Total Members","B","Total Business","All Products")

total_members = A_members + B_members

A_factor = A_desired_percent * SafeDivide(total_members,A_members)

B_factor = B_desired_percent * SafeDivide(total_members,B_members)


If IsChild("Customers","A") Then

CellValue = A_factor * ActivityDriverValue(,,,"Total Members",,,,"CO4 Unassigned","CO5 Unassigned")

Elseif IsChild("Customers","B") Then

CellValue = B_factor * ActivityDriverValue(,,,"Total Members",,,,"CO4 Unassigned","CO5 Unassigned")

Else

CellValue = 0

End if

End Function

Thank you for any help you can provide!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • 5 days ago

    Hi Robert,

    John from Atlanta here. It is not clear to me the objective you are going for.

    ..."I really only want the sum of members under A / B for those that are selected in allocations."

    If you can mock this up in excel with a screenshot, I might be able to assist with the code bits further.

    That said ->

    Many selection challenges in PCM can be minimized with the use of an alternative hierarchy. So, if both the A set children and the B set children are under a single parent, the manipulation becomes easier when A and B parents are not there to worry about.

    Main Hierarchy
    DimParent
    -A
    --A1
    --A2
    --A3
    -B
    --B1
    --B2


    AltHierarchy
    -ABmanipulation
    --A1
    --A2
    --A3
    --B1
    --B2

    Kind Regards,

    John Harris

    Add comment
    10|10000 characters needed characters exceeded

  • 3 days ago

    Hi John,

    thank you for your response and sorry for any confusion! I hope I'm doing this right as I can't reply directly to you nor do I see an edit link in my original post (I think).

    I'm pretty experienced in Excel, but my extent of PCM is looking at existing rules. Based on looking at various rules, I believe the original posted code is correct. But, to respond to you, I created a flow of data in Excel. I hope it's understandable.

    Add comment
    10|10000 characters needed characters exceeded

  • yesterday

    The missing piece to this puzzle is how the identification of selected member is to be done. Once that is identified, the rest is just code for a rounding routine.

    Please let me know.

    Kind Regards,

    John

    Add comment
    10|10000 characters needed characters exceeded