The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

How do I calculate the time difference between many values?

MaxPrMaxPr Member Posts: 2 Learner I
edited June 2021 in Help
Hello everybody,
I want to calculate the production time of a machine per order (idOrder). There are a total of 53 orders.
In this example, I have to subtract the time of line number 408 from 399, since the machine was active at that time.

Can you tell me how I calculate the production time?

Best regards and thank you very much
Max

Tagged:

Best Answers

  • rfuentealbarfuentealba RapidMiner Certified Analyst, Member, University Professor Posts: 568 Unicorn
    Solution Accepted
    Hi, @MaxPr

    What is the criteria used to know what are the values to substract? Is it the code?

    I did the following with some sample data:

    The data:



    I got that data, and applied two aggregations: the min(date), grouped by the code, and the max(date), again grouped by the code. Here is a screenshot.


    When I joined these values, I got the following:


    And then I added another operator named "Generate Attributes" with the following configuration:



    The function expression to substract one date from another and get the number of seconds between the minimum date and the maximum one is the following:

    floor(date_diff([minimum(date)], [maximum(date)])/1000)

    (I got the screenshot before correcting the formula, so, sorry).

    You can finally clean up and do whatever you want with that info.

    Hope this helps. Please find attached the process and data too, if you wish to try it.


  • MaxPrMaxPr Member Posts: 2 Learner I
    Solution Accepted
    Hi @rfuentealba,
    thanks for your answer. Your solution helped me a lot.  B)
Sign In or Register to comment.