Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Create calculated column from several connected tables

I have a Task and Resource table, which are connected using a common TasktoResource table. I have another ResourceValue table and would like to sum the values from that to the Task table.

 

Task     

TID 1
TID 2
TID 3
TID 4

Resource

RID 1
RID 2
RID 3

RID 4

TasktoResource

TID 1RID 1
TID 1RID 2
TID 2RID 3
TID 2RID 4

 

ResourceValue

RID 110
RID 220
RID 330
RID 440

 

I am hoping to create a NewTable with a calculated column having the following results (sum of ResourceValue per Task) -  

NewTable

TID 130
TID 270
TID 3 
TID 4 

 

Not sure which relationships I should establish for this NewTable either. Appreciate any advice on achieving this. I tried it in PQ using Merge tables, and don't think it's very efficient as it's taking a long time to process. The actual data will have 10k+ rows of Tasks and 100k+ rows of Resourcevalue.

  • based on your relationships you should be able to summarize into a new table.

     

    NewTable =
    SUMMARIZE(Task,
              Task[TaskID],
              "Value", sum(ResourceValue[Value]))
     
    see attached. 

4 Replies

  • vanessafvg's avatar
    vanessafvg
    Community Champion

    what does your relationship view look like of these tables?

  • Anonymous's avatar
    Anonymous
    Not applicable

    Task <1:many:both> TasktoResource <many:1:both> Resource

    Resource <1:many:both> ResourceValue

    NewTable <1:1:both>Task

     

    Hope this makes sense!

    • vanessafvg's avatar
      vanessafvg
      Community Champion

      based on your relationships you should be able to summarize into a new table.

       

      NewTable =
      SUMMARIZE(Task,
                Task[TaskID],
                "Value", sum(ResourceValue[Value]))
       
      see attached. 
      • Anonymous's avatar
        Anonymous
        Not applicable

        vanessafvg 

        This is exactly what I needed. Thank you for taking the time to assist with this!