Creation of a new table in Power Bi Desktop

Viewed 71

I have a problem with Power Bi.

In fact, I have 2 tables A (before) and B (after) which represent changes in activities, as well as its schedules for customers. The same customer has several different business lines. Sometimes there are changes at the activity, but sometimes the activity is not changed at all, but location change in table B (after). They are connected to each other with the unique key

I would like to obtain the final table C, which will only have one line per customer, and which would allow me to see:

  • the difference in minutes from the start of the day (after - before)
  • the difference in minutes for the end of the day (after - before)
  • the total number of "work" in the "activities' type" column
  • total number of jobs modified
  • if the working hour has been modified
  • if the job number has been modified

Thank you

Table A

Table B

Table C

1 Answers

One possibility is:

  1. Create Table C containing only column Key.
  2. Create a relationship between A and C, B and C using column Key.
  3. Create a new calculated column in Table C, taking A and B data.

IMPORTANT: in step 3) the calculation has to be done using the function CALCULATE in order to explicit the relation A,C and B,C

Result = CALCULATE(SUM(data from Table A),Table C[Key]=Table A[Key]) 
       + CALCULATE(SUM(data from Table B),Table C[Key]=Table B[Key])
Related