Skip to main content

I have a line chart with running totals by group. To allow users to zoom in, I am attempting to follow this post from the Flerlage Twins to truncate the Y axis without overexaggerating the trends. I thought I had it working because the plot did shift up but, per the label on the reference line, the math ain't actually mathin'. I've tried various iterations of the calculation but can't get it to work. The calc I am using to get the plot below is

window_min(RUNNING_SUM(sum([Value])))-(window_max(RUNNING_SUM(sum([Value]))) - window_min(RUNNING_SUM(sum([Value])))) * 2 

Window calcs for running sums not working

By toggling the calculation in the reference line between min/max, I'm able to draw a line at the min and max of the entire plot, but I'm unable to actually isolate those points to use in calculations. I'd appreciate any help! 

 

#Tableau Desktop & Web Authoring

1 answer
  1. Today, 9:54 PM

    Hi Xin - the symptom you describe (min/max only ever land on the WHOLE plot, can't isolate per group) is the classic nested table-calc addressing trap. Your calc nests two table calcs - RUNNING SUM inside WINDOW MIN/MAX - and each level has its OWN Compute Using. Right now the window is addressing across the entire table, so it returns the global min/max, not each group's. 

     

    Fix it in Edit Table Calculation: 

     

    1. Because it's nested, there's a dropdown at the top to pick WHICH calc you're configuring. Set both levels: 

    - Running sum: compute along your date/continuous axis, partition by Group (so the running total restarts per line). 

    - Window min / Window max: use Specific Dimensions with the SAME date field as addressing, Group left as the partition. 

     

    2. Quick shortcut: change the window calc's Compute Using from Table to Pane. 'Table' runs across every group (= your whole-plot line); 'Pane' restarts per group - exactly the isolation you're missing. 

     

    The reference-line label 'not mathing' is a second, separate trap: a reference line RE-aggregates whatever you drop on it using the Min/Max/Avg you pick, at its own scope - so it ignores your calc's addressing and just draws the marks' own min/max. Once your window calc is addressed per Pane it returns one value per group, so set the reference line to that field with aggregation Average (or Constant), Per Pane - not Min/Max. 

     

    If the only goal is truncating the axis honestly, a lighter route is two parameters (Axis Min/Max) driving a Fixed axis range - no nested calcs to wrangle. 

     

    Hope that isolates it 🙂

0/9000