Forum Discussion

Martijn2's avatar
Martijn2
Frequent Visitor
1 year ago
Solved

Connecting startimes/endtimes with a timedate table

Hi all,

 

I am currently running into a tricky task where I want to link 2 tables. Table 1 contains start times, stop times and duration for each machine. We have a total of 12 machines, which could possibly be on for the same period of time. Table 2 consists of seconds rows of minutes in the period 2018 to now. Now I would actually like to see in that 2nd table in a binary system which machine is on per minute. See example below. Anyone suggestions on how I can accomplish this?

 

 

 

The result: 

 

 

Thank you in advance

 

 

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Martijn2 ,

     

    If you don't want to change Table1, you can also try creating the following measure:

    Measure = 
    VAR __cur_datetime = SELECTEDVALUE('Table2'[DateTime])
    VAR __result = COUNTROWS( FILTER('Table1','Table1'[StartTimeNew]<=__cur_datetime && 'Table1'[EndTimeNew] >=__cur_datetime) )
    RETURN
        __result

    matrix row -- 'Table2'[DateTime]

    matrix column -- 'Table1'[MachineCode]

    matrix value -- [Measure]

     

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

3 Replies