Forum Discussion

SammyNed's avatar
SammyNed
Icon for Helper I rankHelper I
5 years ago

Combination Sum

Hi  guys,

 

Can you please assist?

I have 2 tables, Table 1 basically shows how much Customer (Column: Y-ID) spent (Column: Spend) purchasing a certain number of products( Column: Orders) under different days (Column: X-ID) 

Table 2, shows all the items (Column: Item) that were purchased by a Customer and the Cost. Table 2 has already been filtered for a particular date (X-ID = 1) and Customer (Y-ID = A).

 

I would like to know if theres any way to show which combination of items were purchased under that particular cost. Table 3 below shows a sample of what i would like. So basically Item a2 and a5 were not part of the items making up the total of R100 spent.

Is it possible?

 

Thanks in advance

 

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    "So basically Item a2 and a5 were not part of the items making up the total of R100 spent."

     

    WHY NOT? What's the algorithm that lets one determine which were and which were not participating in the cost?

    • SammyNed's avatar
      SammyNed
      Icon for Helper I rankHelper I

      Unfortunately there's no particular algorhim, just need to know which Items make up the total spend.  Can be random, sometimes all the items add up to the total spend and sometimes only a few items add up to the table spend.

      • Anonymous's avatar
        Anonymous
        Not applicable

        You're out of luck here. To determine which items could constitute the whole (without any other constraints on the problem) you'd need to check all the possible combinations of items. This is not feasible and it's not the kind of problem that PBI has been created to solve.