5 Replies Latest reply on Nov 17, 2011 11:53 AM by Jonathan Drummey

# Calculation issues with dates

Hi I need to calculate the number of items have been invoiced by day against the total for a percentage. I am new with Tableau so I am not sure how to write the formula. Thanks in advance!

• ###### 1. Re: Calculation issues with dates

You don't need to do any formula writing to do this in Tableau. Here's an (attached) example using the Sample - Superstore Sales (Excel) data:

1. Drag Order Date from the Dimensions list to the Columns shelf. Right-click on the green YEAR(Order Date) pill to change it from Year to All Values.

2. Drag Number of Records from the Measures list to Rows shelf. Right-click on the blue SUM(Number of Records) pill and select Quick Table Calculation->Percent of Total.

3. The display is pretty busy since there are 4 years worth of orders in this data set, so I added a filter for 2011.

Instead of using the Number of Records, you could also do something like a Count on a distinct field like Order ID, or Invoice ID in your case.

• ###### 2. Re: Calculation issues with dates

Thanks Jonathan! that helps out!  is there any way of getting the percentage of the total cumulative instead of having the percent a a point in time? IE percentage completed to the goal by date?

• ###### 3. Re: Calculation issues with dates

This is done in two parts - create a running total, then add a secondary calculation to do the % of total. I'll do this example using the "Count of Order ID" sheet in the percent_of_total.twbx workbook I'd attached:

1. Right-click or click the down arrow on the green CNT(Order ID) pill.

2. Then click "Add Table Calculation..." The Table Calculation [Count of Order ID] dialog appears.

3. For the Calculation Type, choose "Running Total". Make sure Summarize values using is set to Sum, and Running along is set to Table (Across).

4. Then click on the Perform a secondary calculation on result checkbox. The dialog expands.

5. For the Secondary Type, choose "Percent of Total". Make sure Summarize the values from is set to Table (Across).

6. Then click OK. The view is now updated to show a running sum % of total.

• ###### 4. Re: Calculation issues with dates

Works perfect thanks Jonathan!

• ###### 5. Re: Calculation issues with dates

You're welcome!