Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Counting individual orders

Dear dax expert,   The below mentioned sheet displays the amount of production orders per line, per supervisor.   Unfortunately the productIDs are not solely individual orders.   A productionID...
  • Anonymous's avatar
    Anonymous
    7 years ago

    Hi,

     

    Assuming that the table name of the screenshot in your last post is Production and you want to summarize the production in a new table called "ProductionOrderSummary", the following are the DAX codes.

     

    Step 1: Create a calculated table called ProductionOrderSummary

     

     

    ProductionOrderSummary = DISTINCT(Production[UniqueProductionOrder])

    Step 2: Add the start time column.

     

     

    Add a calculated column to ProductionOrderSummary table you have created with the following code.

     

     

    StartTime = MINX(FILTER(ALL(Production),Production[UniqueProductionOrder]=EARLIER(ProductionOrderSummary[UniqueProductionOrder])),Production[Begintijd def])

    Step 3: Add the end time column.

     

     

    Add a calculated column to ProductionOrderSummary table you have created with the following code.

     

     

    EndTime = MAXX(FILTER(ALL(Production),Production[UniqueProductionOrder]=EARLIER(ProductionOrderSummary[UniqueProductionOrder])),Production[Eindtijd def])

     

     

    Step 4: Add the total quantity

     

    Add a calculated column to ProductionOrderSummary table you have created with the following code.

     

    Quantity = SUMX(FILTER(ALL(Production),Production[UniqueProductionOrder] = EARLIER(ProductionOrderSummary[UniqueProductionOrder])),Production[Qty])

     

    Please change the table names and field names in the codes above as applicable in your case.