Forum Discussion

drwillia's avatar
drwillia
Helper I
4 years ago
Solved

Split Row Value by Allocation Table %

Hi,

This problem is a little beyond me, 

I would like to break each record out based on the Commodity dimension.

If that Dimension matches the allocation table then create additonal rows for each Component listed in the allocation table (currently only showing one), once each row has been created multiply the value in revenue by the allocation %

 

For example the top row is replaced by the four below it,

 

 

Rebates (Summary) Table:

Allocation Table:

Please reach out if i have not articulated the problem well enough

Regards

Daniel

  • drwillia 
    Here is the sample file with the solution https://we.tl/t-Cp8LuiRxh9

    Rebates (Summary) = 
    SELECTCOLUMNS (
        GENERATE (
            Rebates,
            ADDCOLUMNS (
                Allocation,
                "Allocated Revenue", Rebates[Revenue] * Allocation[Allocation],
                "Allocated Component", Allocation[Component] 
            )
        ),
        "Date", [Date],
        "Branch Code", [Branch Code],
        "Company Lookup", [Company Lookup],
        "Revenue", [Allocated Revenue],
        "IBP Component", [IBP Component],
        "Source", [Source],
        "Commodity", [Allocated Component]
    )
  • tamerj1's avatar
    tamerj1
    4 years ago

    Hi drwillia 
    Yes you are absolutely right. Here is the updated file with minor change https://we.tl/t-JjBH8gDGjW

    Rebates (Summary) = 
    SELECTCOLUMNS (
        GENERATE (
            Rebates,
            ADDCOLUMNS (
                RELATEDTABLE ( Allocation ),
                "Allocated Revenue", Rebates[Revenue] * Allocation[Allocation],
                "Allocated Component", Allocation[Component] 
            )
        ),
        "Date", [Date],
        "Branch Code", [Branch Code],
        "Company Lookup", [Company Lookup],
        "Revenue", [Allocated Revenue],
        "IBP Component", [IBP Component],
        "Source", [Source],
        "Commodity", [Allocated Component]
    )

7 Replies

  • tamerj1's avatar
    tamerj1
    Community Champion

    drwillia 
    Here is the sample file with the solution https://we.tl/t-Cp8LuiRxh9

    Rebates (Summary) = 
    SELECTCOLUMNS (
        GENERATE (
            Rebates,
            ADDCOLUMNS (
                Allocation,
                "Allocated Revenue", Rebates[Revenue] * Allocation[Allocation],
                "Allocated Component", Allocation[Component] 
            )
        ),
        "Date", [Date],
        "Branch Code", [Branch Code],
        "Company Lookup", [Company Lookup],
        "Revenue", [Allocated Revenue],
        "IBP Component", [IBP Component],
        "Source", [Source],
        "Commodity", [Allocated Component]
    )
    • drwillia's avatar
      drwillia
      Helper I

      Hi tamerj1 im having issue downloading the file. Let me digest and come back to you, thank you.

    • drwillia's avatar
      drwillia
      Helper I

      Hi tamerj1 

       

      Thanks for posting, the issue i have now is if i add components to the Allocation table it generates a combination for every component

       

      CommodityComponentAllocation
      (5) DTTransmission30.00%
      (5) DTTorque Converter10.00%
      (5) DTFinal Drive50.00%
      (5) DTDifferential10.00%
      (6) HYDMajor Cylinders100.00%
      (9) STROther STR100.00%
      (2) ENGEngines100.00%
      (8) E&EOther E&E100.00%
      (6) H&COther H&C100.00%
      (7) F&FOther F&F100.00%
      (1) UCOther UC100.00%
      EMP Other EMP100.00%

       

      So for (5) DT i should only generate for Transmission, Torque Converters, Final Drive & Differential but in reality it is generating for all combinations. 

       

      Am i making sense?

      Thanks

      Daniel

      • tamerj1's avatar
        tamerj1
        Community Champion

        Hi drwillia 
        Yes you are absolutely right. Here is the updated file with minor change https://we.tl/t-JjBH8gDGjW

        Rebates (Summary) = 
        SELECTCOLUMNS (
            GENERATE (
                Rebates,
                ADDCOLUMNS (
                    RELATEDTABLE ( Allocation ),
                    "Allocated Revenue", Rebates[Revenue] * Allocation[Allocation],
                    "Allocated Component", Allocation[Component] 
                )
            ),
            "Date", [Date],
            "Branch Code", [Branch Code],
            "Company Lookup", [Company Lookup],
            "Revenue", [Allocated Revenue],
            "IBP Component", [IBP Component],
            "Source", [Source],
            "Commodity", [Allocated Component]
        )
  • tamerj1's avatar
    tamerj1
    Community Champion

    Hi drwillia 
    Do dyou want to create a calculated table? Please provide copy/paste sample data

    • drwillia's avatar
      drwillia
      Helper I

      Hi tamerj1 . 

       

      This is my current code, which creates a calculated Rebates Table (see Excel attached). 

       

      Rebates (Summary) =
      CALCULATETABLE (
          ADDCOLUMNS (
              SUMMARIZE (
                  Rebates,
                  Rebates[Month],
                  Rebates[Branch Code],
                  Rebates[Revised Customer Name],
                  Rebates[Commodity],
                  Rebates[IBP Component],
                  Rebates[Source]
              ),
              "Revenue"CALCULATE ( - SUM ( Rebates[Sum of Dealer Contribution] ) )
          ),
          Rebates[SOS] = "888"
      )
       
      The above code generates the below table
       
      DateBranch CodeCompany LookupRevenueIBP ComponentSourceCommodity
      Thursday, 1 October 202041001 RockhamptonCompany A-384,831.99OtherRebates(5) DT
      Thursday, 1 October 202043003 Mt IsaCompany B-77.51OtherRebates(5) DT
      Thursday, 1 October 202040001 Brisbane OperationsCompany B-504.26OtherRebates(5) DT
      Thursday, 1 October 202040001 Brisbane OperationsCompany A346.39OtherRebates(5) DT
      Thursday, 1 October 202042002 Mackay Hastings ParkCompany B-18,941.76OtherRebates(5) DT
      Thursday, 1 October 202042002 Mackay Hastings ParkCompany A-263,883.13OtherRebates(5) DT
      Thursday, 1 October 202042008 Mackay Connors RoadCompany B7,859.90OtherRebates(5) DT
      Thursday, 1 October 202042008 Mackay Connors RoadCompany A-116,537.24OtherRebates(5) DT
      Thursday, 1 October 202041001 RockhamptonCompany B-3,879.06OtherRebates(5) DT
      Thursday, 1 October 202040002 ToowoombaCompany A-9,617.72OtherRebates(5) DT

       

      The allocation table is below

       

      CommodityComponentAllocation
      (5) DTTransmission30.00%
      (5) DTTorque Converter10.00%
      (5) DTFinal Drive50.00%
      (5) DTDifferential10.00%

       

      So i just need to split out the rows into the 4 allocation components and then multiply each value by the allocation %, does this make sense?

       

      Thanks

      Daniel