Forum Discussion

Sergej_I's avatar
Sergej_I
New Member
4 years ago
Solved

Merging tables and summarize a column

Hi everyone

 

I have 2 tables.

Table 1 contains these values for example:

The “capacity_total” is a single value for each date in combination with the “WorkCenterNo”

Table 2 contains these values for example:

The “capacity_used” has multiple Rows and values for the combinations of each date and “WorkCenterNo”. (Multiple Production Orders in a single day)

I would love to merge these two tables and get the combination of Date and WorkcenterNo once for each date. (Meaning I want to merge these tables and have a single value of “Capacity_Total” and “Capacity_used” for each combination of the date & WorkCenterNo, so I can calculate the utilization in percent)

The new table should look something like this:

If I could create that structure I could easily get the utilization in percent.

I hope someone could give me a helping hand with this.

Thanks for all the help in advance!

  • Sergej_I 

    you can create a column

    Capacity used = sumx(FILTER(Table2,'Table1'[Date]='Table2'[Date]&&Table1[workcenterno]=Table2[WorkCenterno]),Table2[Capacity_Used] )

  • Sergej_I  you can use the following measures to achieve your goal

     

     

    _TREATAS =
    CALCULATE (
        SUM ( t2[Capacity_Used] ),
        TREATAS (
            SUMMARIZE ( t1, t1[Date], t1[WorkCentreNo] ),
            t2[Date],
            t2[WorkCentreNo]
        )
    )
    
    
    _IN = 
    CALCULATE (
        SUM ( t2[Capacity_Used] ),
        FILTER (
            t2,
            ( t2[Date], t2[WorkCentreNo] ) IN SUMMARIZE ( t1, t1[Date], t1[WorkCentreNo] )
        )
    )

     

     

     

     

2 Replies

  • Sergej_I 

    you can create a column

    Capacity used = sumx(FILTER(Table2,'Table1'[Date]='Table2'[Date]&&Table1[workcenterno]=Table2[WorkCenterno]),Table2[Capacity_Used] )

  • smpa01's avatar
    smpa01
    Icon for Community Champion rankCommunity Champion

    Sergej_I  you can use the following measures to achieve your goal

     

     

    _TREATAS =
    CALCULATE (
        SUM ( t2[Capacity_Used] ),
        TREATAS (
            SUMMARIZE ( t1, t1[Date], t1[WorkCentreNo] ),
            t2[Date],
            t2[WorkCentreNo]
        )
    )
    
    
    _IN = 
    CALCULATE (
        SUM ( t2[Capacity_Used] ),
        FILTER (
            t2,
            ( t2[Date], t2[WorkCentreNo] ) IN SUMMARIZE ( t1, t1[Date], t1[WorkCentreNo] )
        )
    )