# LOD Expressions and Custom Grand Totals: Replacing Table Calculations and Self-Data Blends with LOD Expressions

I’ve been trying to figure out how to write about this one, I think I finally have a simple enough scenario to describe: In my world of healthcare delivery, I have things like different payors where I want to know what % of the population is covered by a certain payor (like Medicare and Medicaid), and I don’t really need to show anything about the rest of the population other than have the raw numbers available in the computation. Using Superstore, we can do a equivalent modeling of that using Customer Segment as a stand-in for a set of possible distinct conditions for each patient (Customer). So I want to know what % of total Sales are in a given Segment, being able to filter for any set of Customer Segment(s) I want, and show the sum of the % of total Sales for only my filtered Customer Segments. Ideally ending up with something like this:

Read on for how this goes from relatively difficult in earlier versions to relatively simple in Tableau version 9.

# Tableau 8.1 Two Pass Totals

Embarrassment is the feeling of getting caught doing exactly what you wanted to be doing.
– Author unknown

Today I get to celebrate a new Tableau 8.1 feature and reveal some obsessive compulsive behavior. My first big set of posts on this blog were about answering a really common forums question, how to customize grand totals. With Tableau 8.1’s new Two Pass Totals feature, you just might not need those posts anymore!

# Learning something new every day: Annotating Subtotals

I’ve been reading Alberto Cairo‘s The Functional Art – which is a fabulous book, btw – and thinking about annotations as part of storytelling. Then Tableau Zen Master Joe Mako posted this yesterday:

# Customizing Grand Totals – Part 3

In Part 1 and Part 2 of this series, I described how Tableau computes Grand Totals and several options for generating your own Grand Totals. In this post, you’ll learn the most flexible method for customizing Grand Totals, via custom SQL to duplicate the data.

In November 2013 Tableau 8.1 also added a new two pass totals feature that may remove the need for customizing grand totals for your use cases, more details are in Tableau 8.1 Two Pass Totals. In December 2015 Tableau 9.3 added total control for placing totals to the left and/or on top of the view.