2 Replies Latest reply on Oct 11, 2018 5:01 PM by KellyJJ

# Find sales growth between each hour and compare the growth for each hour

Hi All,

My name is Manoj and i'm new to Tableau. As per my requirement, i wanted to find out the top N clients for each hour based on the airline ticket sales for each hour.

@

I got three fields, Date&Time, ClientName and the ticket sold by each client for the specified hour.

I'm my dashboard, i like to show top 10 clients based on each hour.

Top N client for this hour.

Top N client for the last two hours (excluding current hour), say if time is 11 AM, then i like to display the list of clients & their contribution with-in 9AM-10AM

Top N clients for the next two hours (excluding last three hours) - time between 7AM-8AM.

Could you please do let me know how it can be achieved?

 Date & Time Clients TotalTicketes 9/9/2018 12:59:59 AM Client-1 100 9/9/2018 1:59:59 AM Client-1 121 9/9/2018 2:59:59 AM Client-1 110 9/9/2018 3:59:59 AM Client-1 32 9/9/2018 4:59:59 AM Client-1 234 9/9/2018 5:59:59 AM Client-1 234 9/9/2018 6:59:59 AM Client-1 543 9/9/2018 12:59:59 AM Client-2 200 9/9/2018 1:59:59 AM Client-2 300 9/9/2018 2:59:59 AM Client-2 10 9/9/2018 3:59:59 AM Client-2 32 9/9/2018 4:59:59 AM Client-2 234 9/9/2018 5:59:59 AM Client-2 390 9/9/2018 6:59:59 AM Client-2 123 9/9/2018 12:59:59 AM Client-3 3000 9/9/2018 1:59:59 AM Client-3 1200 9/9/2018 2:59:59 AM Client-3 10 9/9/2018 3:59:59 AM Client-3 11 9/9/2018 4:59:59 AM Client-3 543 9/9/2018 5:59:59 AM Client-3 32 9/9/2018 6:59:59 AM Client-3 21
• ###### 1. Re: Find sales growth between each hour and compare the growth for each hour

Hello manoj,

Did you find a solution for this?

i created a sample of the top customer by hour report for you here.   Getting by other the combination of other hours is going to be trickier and need more questions answered around what the current selected hour is?   For instance will the hour selected be one of the hours in the vew and have a multi selection option?  how is your data being brought in?  If the view can just contain the aggregate values of the last 2 hours, and the data is not too much, you might just create a data source filter and a new data source.  I would probably do this sort of approach- creating 3 data sources for a selected parameter to use for a filter against the data so only the relative ticket counts come in for the before data, the after data and the current data.

Let us know what you have found for a solution and if you need more assistance.

No tableau version was provided so this example workbook is in 2018.2.

Patrick

1 of 1 people found this helpful
• ###### 2. Re: Find sales growth between each hour and compare the growth for each hour

Hi Manoj,

After looking at your list of requirements, it seems the following two articles will provide the necessary tools to accomplish your goal:

https://kb.tableau.com/articles/howto/using-a-top-n-parameter-to-filter-a-table

https://kb.tableau.com/articles/howto/creating-a-filter-for-start-and-end-dates-parameters

First step would be to create 3 parameters:

1. Create Parameter - Example Name: Hour Start
1. Data type: Date & Time
2. Allowable values: Range
3. Step size: 1 Hours
4. Set from Field: Date & Time
2. Create Parameter - Example Name: Hour End
1. Settings identical to Hour Start
3. Create Parameter - Example name: Top N
1. Data type: Integer
2. Allowable values: Range
3. Minimum: 1
4. Maximum: 10
4. Right click all three parameters and select: Show Parameter Control

Second step is to create a calculated field and build the view:

1. Create Calculated Field - Example Name: Top N
1. Enter Formula: [Date & Time] >= [Hour Start] AND [Date & Time] <= [Hour End]
2. Drag Total Tickets to Rows
3. Drag Date & Time to Columns
4. Drag Clients to Color on the Marks card
5. Right click Clients and select Edit Filter
1. Select Top tab
2. Select By field -> Top -> Top N
6. Drag Hour Range to Columns
1. This will create a True and False split
2. Right click False and Exclude

This will allow you to adjust the range of time and your top N based on the example questions you seek to answer.

Attached is a copy of a workbook I created by performing the above steps.

Cheers,

Kelly

1 of 1 people found this helpful