3 Replies Latest reply on Mar 26, 2012 7:44 AM by Jonathan Drummey

# How to do Window_Sum on a specific Measure

HI.

How do I calculate a Window_Sum on a specific measure? I have a table with Sales Growth % by each branch and by each distributor. Currently the dashboard I have is showing the growth % of each dealer within a branch. My question is How do I add the overall growth % of each branch to this...?

Something like this..

 Company Branch 1 Distributor Growth % ABC Los Angeles A1 5% ABC Los Angeles B1 6% ABC Los Angeles C1 7% ABC Los Angeles ABC Total 6%

Thanks

Pavan

• ###### 1. Re: How to do Window_Sum on a specific Measure

I'm not clear on exactly where the growth % of is coming from and how you want to sum that up. However, setting up table calculations to do different aggregations of a given measure is very much possible, as in the attached packaged workbook. You need to be setting the Compute along/using to Advanced... and then put in all the dimensions except the one you want for partitioning. Here's an example using the Superstore Sales DB. I put the Category, Sub-Category, and Product Name hierarchy on the Rows shelf:

Then I set up three table calcs on SUM(Sales) that all have the same basic Percent of Total formula. I set the Compute along/using to Category and Product Name for the % of Sub-Category Sales, so the calculation is partitioned (i.e. creates a different result for) for each Sub-Category.

Then for the % of Category Sales, I set to Compute along/using to Sub-Category and Product Name. The % of All Sales I just left at the default Table (Down) partitioning, which works fine.

If you haven't read this white paper yet, it's a good overview: http://www.tableausoftware.com/sites/default/files/pages/table_calcs_in_tableau_6.pdf

And working your way through these calcs makes a good start at learning table calcs:

http://www.tableausoftware.com/table-calculations

Let me know if this helps!

Jonathan

• ###### 2. Re: How to do Window_Sum on a specific Measure

Thanks Jonathan.

I apologise. I should have been more clear. Here is how my source data looks. The excel bar chart below is what I am trying to show in Tableau.

I think Window_Sum function will help here. But I am not sure how to do Window_sum for each Distributor and for each product category? Thanks for your help again.

Pavan

 COMPANY MONTH DISTRIBUTOR PRODUCT CATEGORY LAST YEAR THIS YEAR GROWTH \$ GROWTH % ABC 1 A1 KITS 100 200 100 100% ABC 2 A1 KITS 200 300 100 50% ABC 2 B1 REFILLS 300 400 100 33% ABC 1 B1 KITS 400 500 100 25% ABC 2 C1 REFILLS 500 600 100 20% ABC 1 C1 KITS 500 600 100 20% ABC 3 A1 KITS 500 600 100 20% ABC 3 A1 REFILLS 500 600 100 20% ABC 3 A1 REFILLS 500 600 100 20%

• ###### 3. Re: How to do Window_Sum on a specific Measure

Hi Pavan,

Can you post a packaged workbook with some sample data? I think that would be easier to work with than trying to interpret your data and then generate calculations that you could implement, which is what I tried in my prior post. That way I could show you more exactly what you want.

Jonathan