
1. Re: Higher Level Calculation
Jim Wahl Mar 21, 2013 8:22 AM (in response to Raina S)Hi Raina,
You can use a table calc filter to apply a "visual" filter without changing the underlying data used to calculate aggregates. This works because table calc filters are applied after table calculations.
Step 1: Create Segment %
Create a new calculated field, Segment %
WINDOW_SUM(COUNT([CM]))/WINDOW_SUM(COUNT([PM]))
This looks similar to your Store %, but uses the table calc window function. To add this to your view, first add Segment and Store to the Rows shelf. You'll need these to adjust the partition / window the table calc operates in.
Next add the Segment % to the measure values shelf, rightclick on the pill > Edit Table Calculation > Compute Using > Advanced and add Asset, Segment and Store to the righthand "Compute using" box (in that order). Click OK. Select restarting every Segment. Now the partition window for your formula is all the store values for each Asset and Segment.
Step 2: Add STORE Table Cal for filtering
Create another calculated field called STORE Table Calc with the formula:
lookup(min([STORE]),0)
The formula here is not that important so long as you get all of the STORE values, which we'll use as a filter.
Add this to the Filter shelf. Now you can filter by the table calc, but the Segment % table calculation has already been computed and is not affected by the table calc filter.
See attached. There's another example of this technique here: A Jedi (Filter and Table Calc) Trick  Tableau Software
Jim

Sample_jimw.twbx.zip 67.3 KB
