Forum Discussion

JockerBoy's avatar
JockerBoy
Regular Visitor
1 year ago
Solved

Table Hours In and Hours Out

Hi, i have 4 types of vehicles and i have 2 gates for entering and getting out.

I have this record:

TRUCKGATE INHOUR INGATE OUTHOUR OUT
Truck 1Gate 109:00Gate 309:35
Truck 1Gate 110:00Gate 310:35
Truck 2Gate 110:10Gate 311:40
Truck 3Gate 309:10Gate 110:45
Truck 4Gate 310:20Gate 111:50
Truck 2Gate 111:30Gate 313:50

I was thinking in creating some type os scatter chart to show each truck at each time where they enter and where they get out.

But i'm getting nowehere. I can't event add the hours in Y-axis.

Can someone help me on this?

 

Thank you?

Goncalo

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi, JockerBoy 

    Based on your table, you can create a new calculated column to convert hours to minutes, and then put it into the Y-axis. I've taken some of your data and done a demonstration.

     

    Just like this:

    HourMinutes = HOUR([HOUR]) * 60 + MINUTE([HOUR])

     

     

    How to Get Your Question Answered Quickly

    Best Regards

    Yongkang Hua

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

5 Replies

  • JockerBoy 

    Go to Power Query Editor.
    Duplicate your table.
    For the first table, keep columns Truck, Gate In, and Hour In, and rename them as Gate and Hour.
    For the second table, keep columns Truck, Gate Out, and Hour Out, and rename them as Gate and Hour.
    Append these two tables together to create a single table with the columns: Truck, Gate, and Hour.

     

     

    LIKE:

    Truck Gate Hour
    Truck 1 Gate 1 09:00
    Truck 1 Gate 3 09:35
    Truck 1 Gate 1 10:00
    Truck 1 Gate 3 10:35
    Truck 2 Gate 1 10:10
    Truck 2 Gate 3 11:40

     

    Add a Scatter Chart visual to your Power BI canvas.
    Set the fields:
    X-axis: Gate (Categorical)
    Y-axis: Hour (Time)
    Legend: Truck (to distinguish trucks)
    Details: Add Truck to ensure proper differentiation.

     

    Format the Y-axis to display hours correctly by ensuring the column is recognized as a Time data type.
    Use different colors for each truck for better visualization.

     

    πŸ’Œ If this helped, a Kudos πŸ‘ or Solution mark βœ… would be great! πŸŽ‰
    Cheers,
    Kedar
    Connect on LinkedIn

    • JockerBoy's avatar
      JockerBoy
      Regular Visitor

      Hi,

       

      I can't add the hours in the Y Axis.

      I formated my Hours as "Time".

  • JockerBoy's avatar
    JockerBoy
    Regular Visitor

    I tried another thing. i added new clolumn for Hour and minutes using "Hours" column.

    And i get this:

    But the Y Axis only accept "sum of Hours" or another type of calculation.

    Maybe i can't use the scatter chart?

     

    GonΓ§alo

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi, JockerBoy 

      Based on your table, you can create a new calculated column to convert hours to minutes, and then put it into the Y-axis. I've taken some of your data and done a demonstration.

       

      Just like this:

      HourMinutes = HOUR([HOUR]) * 60 + MINUTE([HOUR])

       

       

      How to Get Your Question Answered Quickly

      Best Regards

      Yongkang Hua

      If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • JockerBoy You can also try like by creating two columns as:

     

    Total Mins = MINUTE(Vehicle[HOUR OUT] - Vehicle[HOUR IN])
    Column = Vehicle[GATE IN] & "-" & Vehicle[GATE OUT] & ": Total Mins - " & Vehicle[Total Mins]