1
votes

I have 2 dimensions, “departure” & “arrival”. Both these dimensions are in DATETIME format. I want to display the number of records having departure & arrival for each hour (0 to 23hrs), as side-by-side bar chart.

I have tried different ways to create the visualization, but I can't figure out where I am going wrong. I have attached my Tableau file.

Sheet: Wrong_count_for_arrival --> If i choose, "Departure" in my Column field, The "departure" count is correct, however, "Arrival" count is wrong. And, if i choose, "Arrival" in my Column field, The "Arrival" count is correct, however, "Departure" count is wrong.

Sheet: double_values --> To correct above, if i put the "Departure" & "Arrival" in Columns field, then I am getting double values for both "departure" & "arrival" count.

I am trying to get visualization similar to "Wrong_count_for_arrival", but with correct count.

Attached is the Tableau workbook. Tableau workbook-sample data

1

1 Answers

1
votes

In your requirement arrival and departures are not related.
I achieved your desired view by doing these simple steps-

  1. Pivot the two fields in data tab of tableau itself
  2. let's say first field after pivot be 'arr or dep' which will be a dimension and another field be 'time' which will be date field.
  3. add calculated field using datepart('hour', [time]) then create bins of size = 1 from this field
  4. You'll get your desired view by adding hour_bins and 'arr or dep' to columns, sum(number of records) to rows and additionally arr_or_dep to color marks

Image preview