Tableau Newbies: LODs vs Table Calculations
1h 29m 13,070 words transcribed
Summary
The July Tableau Newbies User Group, a stop on its Road to Certification theme, takes on the two functions newer users find hardest: level of detail expressions and table calculations. Jim Dehner explains FIXED, INCLUDE and EXCLUDE, how each is aggregated, and where they sit in the order of operations, so you can predict which filters change them. Swathi Mutyapu covers table calculations: computed on the view rather than the data source, defined by scope and direction, and built with row-position functions such as INDEX, SIZE, FIRST, LAST and LOOKUP. Guest speaker Johan de Groot, founder of Antichaos, a first-time Tableau Visionary and five-time Ambassador, then answers the question that follows: which one to reach for. He works through running totals, customer cohorts, ranking, best customers, percent of total and year-over-year, solving each both ways where possible. His rule of thumb is to ask whether the answer depends on order and on what's in the view, or must exist before the view does. Madeline Wild closes with a quiz.
Listen to this TUG
Prefer to listen? This meeting is also an episode of the Tableau TUG recordings podcast.
Key points
- An LOD expression sits in curly braces: FIXED, INCLUDE or EXCLUDE, then a list of dimensions, a colon, and an aggregation. {SUM([Sales])} on its own is a table-level LOD.
- An LOD returns an aggregated value but isn't aggregated itself, so you can use it like any other field in your data.
- FIXED LODs are calculated after context filters but before dimension filters. To stop a filter affecting one, leave it as a dimension filter; to make it apply, add the filter to context.
- INCLUDE and EXCLUDE are calculated after all dimension filters, so they respond to them. EXCLUDE goes up to the next level in the view.
- Table calculations run last in the order of operations and work on the data in the view, not the data source.
- Every table calculation needs a scope (table, pane or cell) and a direction (down, across, or one then the other). A triangle on the pill tells you a measure has one.
- The row-position functions INDEX, SIZE, FIRST, LAST and LOOKUP are the building blocks for more complex table calculations. Specific Dimensions, Restart Every and Sort Order control how they're addressed.
- Knowing both isn't the hard part; knowing when to use which is. If the question is about order (before, after, previous), it's almost always a table calculation.
- A running total can't be done with an LOD because the data has no concept of order. In SQL it's a window function that has to be rewritten every time the question changes.
- When the answer must exist before the view does, such as each customer's first order date regardless of the year you filter to, reach for a FIXED LOD.
- Rank isn't a property of a row: it depends on what else is in the view. Change the bars and the rank changes, which makes it a table calculation.
- Filtering on SUM(Sales) ≥ 5,000 filters marks in the view, not customers. To keep customers who have spent $5,000 in total, compute a FIXED total per customer and filter on that.
- Percent of total gives the same answer both ways until you filter. An LOD is a share of all data; a table calc is a share of what's in the view.
- Filtering a table calculation with LAST() = 0 only hides marks, because Tableau still knows the earlier values. It's a view filter, not a data filter.
- You can nest LODs in LODs, table calcs in table calcs, and LODs inside table calcs, but never a table calc inside an LOD.
- A broken table calc usually fails loudly with blanks. A wrong LOD quietly gives you a wrong number, so check it.
Jump to a chapter (22)
- 0:00 Welcome to the July Tableau Newbies User Group
- 2:32 Five years of the Newbie Group, and the Road to Certification
- 4:42 Meet the Newbies team
- 9:00 What's coming up, and certification resources
- 11:53 Jim Dehner: writing an LOD expression
- 16:47 Filters and the order of operations
- 21:57 INCLUDE and EXCLUDE
- 27:02 Swathi Mutyapu: what a table calculation is
- 28:50 Scope and direction
- 31:16 Quick table calculations and the Edit Table Calculation pop-up
- 34:43 Row position functions: INDEX, SIZE, FIRST, LAST and LOOKUP
- 41:00 Table across, table down and specific dimensions
- 46:19 Swag draw
- 47:20 Introducing Johan de Groot
- 48:12 LOD or table calc? Running totals
- 55:48 Customer cohorts with a FIXED LOD
- 1:02:32 Ranking
- 1:08:45 Best customers: why filtering on sales isn't enough
- 1:12:16 Percent of total, both ways
- 1:15:43 Year over year as a single KPI
- 1:21:22 Love them both, responsibly
- 1:23:39 The quiz and wrap-up
Transcript
0:01 Jim Dehner: Good morning, everybody. Welcome to this July edition of the Tableau Newbie User Group. We're so glad to have you with us, and, uh, we've got a great show for you today.
0:12 Okay, we wanna thank you for being here. We wanna thank you for being part of the community. We really do wanna thank you for being part of the Newbie Group. We know some of you have been with us from the start, that's five years now. Uh, others are, are new to, uh, new to the group altogether. Uh, we'd like to ask you, go out to the chat and put in, uh, where you're from.
0:32 We'd like to know where you're from. And we'd also like to know, uh, since it's summertime, at least here in the North America, it's s- it's, uh, summertime, whether you've gone on holiday or you've taken vacation, uh, at this point. And if so, where'd you go, and did anything special happen?
0:49 Now, I'm asking 'cause I got back from vacation yesterday. I was in the northern part of, uh, Georgia in the mountains, and a couple of… We had rented a place, we'd rented a VRBO, and these guys came up the driveway.
1:02 That's, uh, mama bear and baby bear, and, um, scared the daylights out of us, to tell you, uh, to tell you the truth. Oh, we got somebody here from, uh, Atlanta. You just got back from Jordan. Okay. The bear scared you so that you went to Jordan? You didn't have to, have to stay in, uh, stay in the US.
1:22 Uh, from Baton Rouge, you spent the we- the Fourth of July weekend in Chicago. That must have been a great weekend in Chicago.
1:28 And, uh, hi Kim from Columbus. Uh, and we, we see… Wait. It, it's happening very fast out here. Uh, uh, welcome Vancouver, Canada.
1:42 We're gonna, we're gonna move on now, and, uh, Ma- uh, and Priya, do we record this meeting? Is this meeting gonna be recorded?
1:52 Priya Padham: Well, good news is it will be. So don't worry, sit back, relax, you won't miss a thing. Just check out the recording later if you want to. But yes, it will be recorded. Scan the QR code, and I'm sure the team will post it in the chat as well. And speaking of which, housekeeping rules for today. Please make sure audio and video is disabled, just means we won't interrupt anyone when they're speaking.
2:12 But you can definitely use the chat to interact. We wanna hear from you. Keep talking to us. Let us know when you find something cool, or if you just wanna tell us something, let us know in the chat. And again, we al- we also have a Q&A as well. Post your questions in there, and our team will get back to you very soon.
2:32 Jim Dehner: Okay. Now, some of you are brand new. This might be your first, uh, Newbie Group meeting, and we just wanna give a little history, tell you where the Newbie Group started. Uh, this is our f- our fifth year for the, uh, for the Newbie Group. We meet every six to eight weeks.
2:47 Now, uh, we say newbie. This is really for people who maybe have a year or two years experience, uh, wanna level up their skills, and then probably move on to another user group, like maybe the analytics group or, uh, one of your local user groups. And we encourage you to do that after you've had some e- experience with us.
3:07 This year, we have a theme, uh, that's, uh, the, the theme for this year is the road to certification.
3:15 And, uh, we're going to go through the major topics that you'd need for the cert, uh, to be certified, uh, in, in Tableau.
3:24 Each meeting is broken down into two parts. The first part is the how does that work part, and that's done by members of the Newbie team.
3:33 And, uh, the second part of the meeting is a, um, uh, we have a community speaker. We have a, a speaker from the community based on a topic that goes with the theme and maybe a topic that you've, uh, you've asked a lot about. And then at the end of the, uh, uh, at the end of the meeting, uh, Maddie's gonna have a quiz for us. And I think we're giving stuff away, aren't we, Maddie?
3:53 Are we giving– We're still– We're giving swag away, so stay to the end of the meeting and, uh, uh, stay till the end of the meeting, and, uh, you have a chance, uh, to win some swag.
4:06 Well, let's go through the, uh, the agenda today.
4:10 On– Today, we're gonna focus on two types of, uh, Tableau functions: LOD expressions and table calculations. And we know those give you a lot of trouble and, uh, we're going to go through, first of all, the mechanics of how, uh, how to create those, uh, expressions. And then, uh, Johan, who's our guest speaker, is gonna show us, uh, some examples, some use case examples of when to use them and how to use them.
4:34 A- and that'll be followed by, uh, uh, by Maddie's quiz.
4:42 Priya, you wanna start introducing-
4:43 Priya Padham: Yeah
4:43 Jim Dehner: … yourself?
4:44 Priya Padham: Yeah.
4:44 Hello, everyone. My name is Priya Padham. Um, I've been part of the NewbiesTUG now for… well, since January, so it's very exciting. Such a lovely team. Very happy to be here. I'm also a Tableau Visionary and Ambassador. And yeah, I love Tableau and looking forward to connecting with you all. I'll pass it on over to Swathi.
5:02 Swathi Mutyapu: Hello, everyone. My name is Swathi, and I'm based in London.
5:06 It is so hot in here, and I'm just going to present, uh, probably the next few slides that you will be seeing me about Tableau table calculations as well. And I've been using Tableau since five years now, and I've been part of this amazing team two years already. So here I am.
5:27 Passing it to Viraj.
5:30 Viraj Bhargave: Hey. Hi, everyone. Viraj here. I'm from Mumbai, India, and I'm a, you know, Tableau newbie at heart. Uh, as I keep saying it, I am Tableau Ambassador, and been part of this awesome community and the, uh, TUG for the last five years, so welcoming you all to the event.
5:50 And we don't have Ankur, uh, who is also from India. He has… is not there in, in the meeting today, uh, so I'm handing it over to Ben.
6:02 Benjamin Akinmoyeje: Good afternoon, everybody. My name is Benjamin Akinmoyeje.
6:06 I'm talking to you out of Namibia, Windhoek, Namibia, just above South Africa.
6:11 I've been part of this community for about a year now, and I've been into Tableau for almost four years. So I'm excited to be here, and I'm going to do the lucky draw, so stay tuned. Thank you.
6:25 Jim Dehner: Okay.
6:26 Laura?
6:28 Laura Mathew: Hi, uh, I'm Laura. Um, I am, uh… I work as a senior BI and data analyst in Chicago for a law firm.
6:36 Um, I've been part of… I first started, uh, as a part of, like, newbie team when we first, like, in 2022, I believe. I was part of it, and then I took a little break. I came back to the group, and it's just been such a wonderful community. I learned so much from, you know, being part of the community, meeting new people. Like, it's just been so much fun being here, and I was lucky enough to present, um, fortunate to be, be pres- presenting the last, um, at the last meeting, and I learned a lot.
7:04 Let me put it that way. So it was… it's just been… I've been… I'm so grateful to be part of the team, and welcome.
7:10 Jim Dehner: Okay.
7:11 Maddie?
7:13 Madeline Wild: Hi, everyone. I'm Maddie Wild. I'm in Indianapolis, Indiana. I work for the Fairbanks Foundation, um, and a local Indianapolis foundation. I work a lot with government data and public data. Um, and then I've been using Tableau since 2021 or 2022, I can't remem- I think 2021, yeah. Um, and then, then joined the newbie team in 2022. I think that's right.
7:42 Jim Dehner: Okay. Uh, Johan. Johan is our guest speaker today. Johan, why don't you just introduce yourself and tell everybody where you're from?
7:50 Johan de Groot: I'm from Netherlands. Uh, you know, that small country which isn't visible right now because Swathi is on top of it.
7:57 Uh, I've been using Tableau for almost 20 years now, and stuck at nominated for Newbie of the Year last year, so I was kind of surprised.
8:05 Uh, I've been a Visionary for last five years, and this year f- first Visionary, uh… Ambassador for the last five years, and this, uh, this year, the first time Visionary.
8:15 And love to, uh, yeah, talk and nerdy about Tableau.
8:19 Jim Dehner: Okay.
8:20 Uh, I see Ankur has just joined us. Ankur, you wanna, uh, start your camera and, uh, introduce yourself?
8:30 Ankur Napa: Uh, hi, everyone. I'm Ankur, uh, from Bangalore, India.
8:35 And, uh, before doing Tableau, I was making beers, and nowadays I'm making good selling beers using Tableau.
8:44 Jim Dehner: Making good selling beers. Well, there you go. Nothing wrong with that.
8:48 My name's Jim Dehner. I live in Nashville, Tennessee, and, uh, I'm one of the, uh, one of the, uh, Tableau Visionaries, and we are thrilled to have you here today, all of you.
9:00 Priya Padham: Perfect. So, like Jim mentioned, we have The Road to Certification. Now, it's been an action-packed year already, and I can't believe it's almost the end of the year, which is weird. But, um, like we mentioned, today we'll be talking about LODs and table calcs, and then we have our wonderful guest, Johan, who'll be talking about LODs and table calcs, and use cases as well, which is really cool.
9:21 And then next month… Actually, not next month, in September, we have, uh, which chart best meets your needs, and then we have the amazing Dennis, who will join us to talk about maps, because he's the pro at maps if you know Dennis. Then in October, we have filters, sets, bins, ref lines, all that good stuff, and then we have Claus joining us again.
9:39 He's coming back, yes, and he'll be talking about viz Extensions. And then finally, to end off the year in November, we have dashboarding, formatting, actions, all of that kind of finishing touches that you'd put on a dashboard. And then we have Lisa Trescott coming to talk about Storytelling 101. Phew, there's a lot, there's a lot still coming, and if you missed anything, um, that we've had in the past, again, all recorded, check out, um, the link that I think Viraj has posted in the chat.
10:10 Perfect. So, just a reminder that we are not a training program, but there's loads of resources you can check out to get certified. So you can see here we have links to Salesforce and Trailhead Academy. You can also register for the exam, and there's also an exam guide as well. And bonus… Oh, flashed up there. We're back.
10:32 But bonus content, Andy Kriebel, we all know Andy Kriebel, um, Next Level Tableau, we have 30-day free access. And Ken and Kevin Flerlage, the, our favorite twins ever, they have an online beginner training for three months free as well. So you better click those links because that's gonna be very, very useful indeed. So check out all of this on the screen now.
10:56 And I don't know who that is, but we have Dennis coming next time, yay, to talk about maps, like I said. And then the person on the left will be talking about which chart to use, and which is best to use when. So definitely sign up. Very excited for that session. It's in September. Scan the QR code and RSVP today.
11:15 Jim Dehner: Yeah, Pri- Priya's sort of underplaying her part. Pri- uh, Priya is outstanding in selecting… not just selecting charts, but using the right chart in the right situation in storytelling. She's g- she's actually gonna present, uh, in November also. So you'll, you'll definitely wanna see this, 'cause we get questions, uh, loads of questions on, "I don't know what chart to use.
11:34 What should I u- what should I be using to express this type of data?" And of course, Dennis, uh, Dennis is a PhD. He teaches, uh, teaches up in, uh, Canada. But he is a, he is a mapping expert, he truly is, and he's very enjoyable to listen to. So you, you gotta, you gotta attend this one.
11:53 Priya Padham: Perfect. So I'm very happy to introduce our very own Swathi and Jim, so go ahead, take it away, and share your screen, Jim. Thank you.
12:01 Jim Dehner: Okay. Very good. Uh- Swathi and I are going to talk about two different functions. We're gonna be talking about, uh, LOD expressions, and then we're gonna talk about table calculations. And we're gonna, we're gonna go through the mechanics of how you go about creating these, uh, different, uh, different types of functions.
12:18 And, uh, then Johan's gonna go in, uh, and do some use cases.
12:22 I wanna start with the LOD expressions, and I wanna show you how to write one. Uh, and this would be the syntax for an LOD expression. They are always enclosed in braces or as, like I refer to them as squiggly brackets.
12:37 And the first word in that, uh, in- embedded in that, uh, bracket is the type of LOD we're going to use, and it's one of three keywords. It's either fixed, include, or exclude.
12:50 And, uh, that can be followed by a list of dimensions. And here we're looking at region and segment, like we have in the Superstore data, and there are four regions and three segments. And if you would say this in words, what we're telling Tableau is take all the combinations of region and segments. So there's four regions, three segments, that's 12 values we're going to end up with.
13:14 That list of dimensions is followed by a colon, and that's telling Tableau how we're gonna aggregate the individual records to come up with those 12 values, and we're going to use a sum and then a metric. And the metric we're gonna use is sales.
13:31 Now what we're doing is if you think of your data, the data that you input, think of it like a, like a pyramid. That lowest level in the pyramid is, uh, we refer to that as the grain of the data or the, or the record level data. And in the Superstore data set, there's about 10,000 records.
13:48 Now, this expression we wrote, uh, fixed region sum, uh, region segment, sum of sales, is gonna return 12 values, and it's gonna create another column, if you will, in your data with just those 12 values in it in each, for each one of those, uh, 10, 10,000 records.
14:09 We could also have written that expression as just regions. We can come back with four values, you know, fixed regions, sum of sales, and we'd have four values. Or we could go to the top of the pyramid and come back with one value, the value of all the sales, the fixed sum of sales, or we could write that in a shorthand way.
14:27 Uh, we wouldn't need to put the fixed and the colon in. It's just a shorthand way, and this is usually referred to as a table LOD. So if you hear people talk about a table LOD, this is what they're talking about.
14:37 Well, let's see how that would work.
14:40 This, uh, is the Superstore data, and, uh, this is the formula that we've started with. We started looking at this.
14:49 We, uh, fixed region, sum, uh, sum of sales, and we can add that to our chart.
14:55 And when we add it to the chart… And I'm gonna drop this down here.
15:00 Okay. When we add it to the chart, it's come back, and it's give us, given us our 12 values, which are the same 12 values if we just sum the sales.
15:08 Okay? We could have looked at the values at the region level and gotten four values.
15:15 And you can see now this formula, this fixed LOD, returns the region sales, and that's eq- equal to the sum of the central region is 503,691 in east, and so on. In each one of the records, we have the fixed at the region level. Now we can use those in a number of ways, and one of the ways we can use them is we can, uh,
15:44 use a calculation to determine the percent to, uh, to the percent to the region total. Now, the beauty of LODs is that while they represent a aggregated value, they are not aggregated in themselves, and you can use them just like any other data in your data set.
16:03 So we, we would use the sum of sales divided by the sum of the regional sales to return a value of the percent to the total region. We could look at the, uh,
16:18 percent to the region segment in a similar fashion.
16:25 And it would look like we're taking this value and dividing it by that value.
16:30 In this column, we are taking that value and dividing it by that value.
16:34 Or we could take the percent overall.
16:39 Okay? And we can get the percent to the overall total or to that fixed value in, uh, the, the total fixed value. Well, that's great. Uh, I'd like to go another step, and I'd like, I'd like to be able to apply some filters to this data.
16:53 Well, we can't talk about filters without talking about the order of operations.
16:58 Now, the order of operations is nothing more than the sequence that Tableau goes through each time, uh, you create a worksheet.
17:05 Now, I like to use this 10-step model. I know there's other models out there. I think Swathi uses a slightly different model. But I like to use this 10-step model. This first two steps in this model, uh, are applied at the workbook level, and they filter data out. Uh, if you're not gonna use the data in the workbook, why have it in there? Your workbook will be more efficient if you just filter it out.
17:28 Uh, the remaining eight steps work at the worksheet level as you create a data table for that worksheet. Each worksheet has its own data table, and that's a subset of the total data. You create that as you put dimensions on the rows and columns. Okay? Now, in steps three, four, and five, we're creating the structure for that data table, and we're also applying context filters.
17:54 And the important part here is that in step four, after the context filters are applied, is when the fixed LODs are calculated. It also happens to be where top N are calculated and sets are, are determined.
18:07 And in step five, dimension filters are applied after the fixed LOD is calculated. So if you don't want the LOD to respond to the filter, you would put the filter as a dimension filter. Now, the remaining steps, all we're doing is loading data, loading measures into that table, the values of those measures. It's important to see that down here in step seven is where the other two LODs are calculated, include and exclude, and that's after all the context filters and all the dimension filters are applied.
18:41 And table calculations are calculated last in the order of operations. Okay?
18:47 Now, let's take a look at how we might go about filtering, uh, using, uh, using two types of filters. I've got a segment filter and I've got a category filter, and we're gonna look at this, at the segment filter first. And this filter right now is a blue filter. It's a dimension filter, and that filter is going to be applied in step five after the LOD is calculated.
19:17 So if we were to,
19:22 uh, if we were to apply a filter, and I'm gonna filter out, uh, the consumer segment.
19:29 And if I remove the consumer segment, you can see I haven't changed the value of our fixed LOD. Our central region still has $503,000 worth of sales, even though the total sales, if I just total the sales of the corporate segment and, uh, the home office segment in central region, it's $249,000. Okay?
19:54 The value, uh, hasn't changed because the filter was applied after the LOD was calculated.
20:01 We could change this to a context filter.
20:06 We'd open it up here. I'm just clicking that down arrow, and we're gonna add this to context. And you can see when I did that, it became a gray filter that, just to show us that it's a context filter, and now it's applied before that fixed LOD is calculated.
20:20 And now when we filter out, uh, the consumer segment, you can see now the sales for those two segments is, uh, $249,000. And because we filtered out the consumer segment before we calculated these LODs, these values do change now so that, um, uh, this fixed region now is the same value as the total sales value.
20:48 Now, uh, we could come back and we could say, "Well, I'd like to apply a filter to a, a dimension that's not in the view." And, uh, we, we're gonna filter our category here, and we're gonna apply the, uh, I'm going to take furniture out. Now, furniture appears in each one of these segments, and I can take furniture out by filtering it out here first as a dimension filter, so it's, um, done after the LOD is calculated.
21:21 So we haven't changed the value of our LOD. Our total sales without furniture is, uh, a million five, where the total value is $2.3 million. Or, or if we take that percent to overall and we total that, it's 67% of the total without, uh, without furniture. And then once again, if we just apply this as a context filter so that now we're, uh, applying the filter before the LOD is calculated, we're gonna see that this value does in fact change when we filter out, uh, the furniture value.
21:56 Okay. We've got an idea of what, uh, how to write a fixed LOD and how to filter. Uh, what is include and exclude all about? Well, we'll take a quick look at the include, first of all, and I wanna take a look at a value here. We're gonna call this, uh, this formula. We're gonna take a look at including the customer name and, uh, we're gonna sum the sales, and that's gonna allow us to have the customer name in the calculation without specifying it in the calculation, without writing it in the calculation.
22:33 Okay?
22:33 So if we take a look here, when we're summing the value, the value, uh, is the same as the overall sales. The difference comes when we take a look at the average. Now, if we take a look at the average for this formula, we've included the customer name, so we wanna know the average of the customer sales.
22:53 Well, that's
22:57 the total sales divided by the number of customers, and that's what I've got here. I've just counted the customers.
23:04 Okay, that's the total sales divided by the number of customers, gets us 953.
23:10 Okay?
23:11 Or we can take a look here, the total sales divided by the number of customers is, uh, is, uh, 200.
23:19 Well, you might say, "Well, why would we wanna do something like that?" We get questions all the time. They say, "Well, what I'd like to do is I'd like to put a, I'd like to put a filter on a dimension, but I don't, I want it to apply some of the time, and the rest of the time I don't want it applied." So I wanna be able to write an equation or a formula
23:47 like this where I have, I'm including the region and I'm calculating our sales at the region level, and I'm doing it with an include statement.
24:00 A- and at the same time, I'd like to be able to write a similar expression at the region level, and I'd like that to be fixed. I don't want that to change.
24:09 So what we do with an expression like that is if we go back to…
24:13 We have our fixed LOD. It's not gonna respond to a dimension filter, but our include statement will respond to a dimension filter.
24:30 So, uh, we can apply that, and I'm gonna just drop this in here, and I am also gonna show you what the nu- this is just the numerator and the denominator. That's all I'm gonna put in here. This is the include statement, okay?
24:46 This is the numerator,
24:50 and this is the denominator.
24:53 And you can see here, our denominator is a fixed value, so it's not going to change when I filter out furniture. That's $2.3 million is not gonna, not gonna change. But you'll notice our numerator is going to change. It's no longer gonna be $391,000. When I filter out furniture, it's gonna change to $363,000. Okay.
25:18 Well, if that's what include does, what does exclude do?
25:22 Well, exclude works somewhat the opposite of that.
25:26 Exclude, uh, takes a look at the next higher level.
25:32 Uh, let's say I were to exclude…
25:39 We wanna take a look here, and we wanna say, well, I wanna exclude the segment, and I wanna see the sales.
25:45 So I'm gonna add that to our chart,
25:48 and I'm just dropping that down here.
25:51 And if we excluded the segment, our next higher level is going to be the region. So if I exclude the segment, I'm looking at the regional total, and you see the values here.
26:06 Or if I exclude the region, and this one becomes kind of fun, if I exclude the region, I'm going to go to the next higher level in our chart, and the value that I get is going to be the segment total.
26:20 So if I add all the consumer values together from the four different regions, it's gonna total, uh, 1.1 million or $1.2 million if I take the consumer segments and add them together.
26:35 So include and exclude are functions that are calculated in step seven of the order of operation, and they're not going to res- uh, they respond to all filters.
26:45 Fixed calculations are, uh, calculated in step four, and they only respond to filters that are applied in context.
26:56 Uh, I'm gonna turn this over to Swathi now, and she's gonna show you how to go about, uh, using table calculations.
27:02 Swathi Mutyapu: All right. Uh, thanks, Jim. It was really nice refresher of how to use the fixed LOD, uh, exclude and include as well.
27:11 In the chat, there's this word of, uh, we are using most of the fixed LOD calculations. Yes, uh, 99% or most of the times we tend to use, uh, fixed LOD because you can achieve the results of include and exclude with fixed as well, but that's not my topic. Anyway, switching to table calculations in Tableau. So I will be, uh, giving you a refresher again on table calculations going the next 15 minutes.
27:40 So, so far we have, uh, understood that the calculations that are done, um, which, which were, um, presented by Jim, these are, these are all the, uh, calculations that are querying the database, okay? Querying the dataset that is attached to Tableau.
27:56 So now, what does this tab- table calculation do? So basically, this is the calculation that you perform on the view that is already calculated on the view. Say, for example, if there is a sum of sales, you add another math to the sum of sales, and then just generate the table calculation.
28:14 So every examples that you can see is running sum of some sales, so you already see an aggregation there. Uh, on top of that aggregation, we are doing another math around that just to produce the table calculation.
28:27 Uh, so like I said, the only difference that you have to clearly understand is that any, uh, basic calculation or any LOD is keeping the data already, but this one, the table calculation, is doing the math on the view itself. So that's the main, uh, role. Let me just jump into the second slide.
28:50 So the next one is that like how are these table calculations, uh, calculated? Like, what do we have to understand about these?
28:58 So two things are really important. One is the scope, meaning how much data to include, whether you have to include the table, whether you have to include the pane section, or whether it is just the cell that the table calculation needs to be performed. And the second one is the direction. Which way should my table calculation work? Is it down? Is it across?
29:21 Or is it down then across, and across then down? So most of the times, you see the combination of these two happening around and across and all, all hundred combinations or whatever the com- combination that we talk in the next few slides. But these are the combinations that you see when a table calculation is being calculated.
29:45 So, um, basically, there are three ways, like how are you going to create table calculations is defined in three ways. One, Tableau has given us this awesome functionality of having a quick table calculation, like as, as you right-click a measure, you just find out, add, click, uh, quick table calculation, which will, um, give you some sensible defaults of what we have to use, whether it is a percentage of total, whether it is a total sum or whatever it is.
30:16 Those, those sensible calculations are already given by Tableau automatically with what the measure is being provided.
30:23 So second one is add table calculations. You will see a little window that you, uh, a window just pops up. We'll see in the later sections. Um, a little window pops up with what type of calculation, like we'll, we'll cover the first two slides of, of scope and dimension, how we have to, um, calculate a particular dimens- a particular measure and in what direction.
30:46 Like, what is the level? Is it a table, or is it a pane, or is it a cell? And what is the direction I want to calculate this particular table calculation?
30:55 And the third way is also creating a calculated field, whether you want to have these, um, beautiful, um, row position functions such as INDEX, rank, lookup, et cetera. All of these you can just add, create those calculated fields and also add, uh, table calculations on top of it as well.
31:16 So next one is a little practical session.
31:22 So the first one is let's, let's recall about what we discussed about the definition of a table calculation is, right? So let me put the category and subcategory onto those.
31:39 And now I'm just going to put the sum of sales onto the text.
31:44 So as you see, this is just querying the data. So this is just giving me sum of sales, and I'm not doing any calculation on top of this.
31:54 So this is the quick table calculation. Like I said, Tableau has provided us with some sensible, um, already calculated way. Like for example, if I click on percentage of total, this is a quick table calculation that Tab- Tableau performs, and this, the triangle indicates that this is a table calculation. Every time you see a triangle on a measure, then it means that there is a table calculation happening.
32:21 So another way is, um, another important thing is the direction of how the table calculation needs to be computed. Is it the table down? How am I calculating this percentage of total, which I've clicked already?
32:35 Is it table down, or is it table, uh, is it table across, or is it pane down? All of these come in, uh, like for example, if I click pane, you should be seeing different percentages for each pane. So pane meaning this section, the section of, of category. So every cell is this one.
32:57 The whole table is complete table, and this is the pane, and this is each row inside the pane.
33:05 Um,
33:07 next one is the pane calculation.
33:11 Again, let me just quickly add category
33:16 and subcategory onto those
33:21 and
33:23 sum of sales here because, again, there's no calculation there, and that is just a aggregation. And if I'm just having, let's say, let me click on to add table calculation. This is the small pop-up window that I told that would be coming up on another screen, of course.
33:47 You can see that this is another type of calculus- uh, all the different types of calculations that you can choose, and this is the how, the direction of how I have to choose my calculation to be performed.
33:59 Say, for example, if I have to say, um, rank, maybe rank is good.
34:07 So you can just see table down and pane down. So you can see with this show calculation assistance, you can see how this pa- uh, calculation is being, being calculated. The yellow highlighted one represents how the calculation of it is being done.
34:23 So what I'm doing here for, uh, furniture, I'm just finding out what is the rank of the sum of sales.
34:30 So here, uh, the rank is defined descending, which is having the h- uh, highest and lowest sales. You can just see that on there.
34:39 I do have totals there, so don't worry about it.
34:43 Uh, previously I did mention about, um, another, uh, uh, row position functions.
34:50 So these are the five row position functions that you can see. And here, these are the most commonly used row position functions. For any complex calculations as well, you can just make a combination of these calculations and also your aggregation, and perform, uh, the, uh, extreme or, or, uh, very high-level calculations as well.
35:12 So INDEX is nothing but, for example, if I just take on my view, if I just take the month of order, and I just drop… Let me just show you.
35:22 What it, what I did here was just, uh, take the month of order date, and it just dropped in INDEX, just a function that I typed in saying INDEX, and I just changed it to text.
35:39 So just wanted to show you. That's why I'm just, uh, changing the view. But anyway-
35:45 Jim Dehner: Swathi? Swathi, I, I, I've, I've got a question. We're getting, uh, we're getting some notes in the chat that they can't see your, uh, the options that are available. Would you just, uh, when you shared your screen, did you share the entire screen or just the window?
36:06 Swathi Mutyapu: Oh, maybe I did share the window.
36:09 Jim Dehner: Okay.
36:09 Swathi Mutyapu: Let me stop sharing.
36:10 Jim Dehner: Hang on, everybody. We'll just g- we're just gonna make this right.
36:16 This is another one of those things that, uh, Bevy does that is a little-
36:20 Swathi Mutyapu: Now?
36:21 Jim Dehner: Now, uh, go over and, and do a dropdown or something that would, would open up a separate window, and let's see if everybody can see it.
36:29 Swathi Mutyapu: Okay. Well, let me just open
36:33 Jim Dehner: There. I th-
36:34 Swathi Mutyapu: Can you see it now?
36:35 Jim Dehner: Yes. Yes. Now I think they should be able to see it.
36:37 Sorry, continue on.
36:38 Swathi Mutyapu: No worries.
36:39 Okay.
36:40 Viraj Bhargave: Yeah. Thanks everyone for coming.
36:41 Swathi Mutyapu: Do you have to go back, do I have to go back somewhere?
36:46 Uh, maybe here.
36:52 Just, just a quick, uh, thing, like…
36:56 So here I just wanted to, uh, showcase the little window that pops up, like the edit table calculation. It shows you the percentage of total. So what is happening here is you are just calculating the percentage of total sales across the pane down. So meaning this is the pane that is highlighted above. And if you have to just do table down, then it, the computation…
37:20 Oops.
37:22 The computation is ca- calculated table down like that. So pane is represented, like only one category or, I mean, of course, like for each of the category and table down is like that. And if you add more, uh, dimensions to the view, then it'll be more, um, uh, you, you can just see what is table across and what is table and what is pane, uh, and cell.
37:47 Cell is just that you have hundred percent. Like now you see for percentage of total, for bookcases obviously it'll be hundred percent and if I have to say pane, then it changes accordingly. So all of this together would be hundred percent.
38:03 Hope that clarifies what that pane, uh, the little window is.
38:10 Um, so going back to this row position functions, uh, like I mentioned, uh, this is,
38:19 this is the function that, uh, gives you the… It represents the row numbers from the top. So it just gives you one, two, three, four, five, six, just, just like an INDEX of a table or a book or whatever you can say.
38:32 So it just gives us the INDEX. Again, you can calculate it based on those, uh, those different, uh, things.
38:41 Second, uh, one is size.
38:45 Size gives you what is the total number of rows in that group. So these are, these are twelve months obviously in twenty twenty-five we have, so this is telling you what is, uh, what is the total number of rows in that group.
39:00 Then the first is how far the row sits below, uh, sorry, below the top.
39:07 So here Jan starts with zero, and when you say first it goes by minus one. How far is this particular row to the top? So that is what is represented by first.
39:19 And last is quite opposite, like how far, how far the row sits above, uh, the bottom zero. So the bottom would be zero and how far that is would give you, uh, the last value.
39:34 Another important thing I think we, we kind of use most of the times is lookup in probably every, um, even in Python or even in SQL or anywhere else, we, we kind of use this, uh, quite often. So lookup is nothing but you are kind of looking up the previous value or any offset value that you have provided.
39:54 Offset represents the number of rows away. So if I just say, this is, this is my sum of sales, okay? If I say lookup sum of sales, that is my expression, and if I say one, then it will go, it will take you…
40:08 Let me see.
40:12 I'll show you that.
40:20 It'll, it'll give you the previous value of that sale. So it is just giving you what is that sales value, so forty-four thousand two fifty-nine, it's giving that. And h- why you are going to use this is because if you, you can just have the row level values, like you can just see the difference of previous month to the current month in a separate column, or you can just use that, uh, for another calculations.
40:44 And all of these calculations you can just put, uh, drag them and create a, a calculation by itself. Like if at all you are using it multiple times, you can just make use of that calculation and use it as well.
40:59 So the pop-up that is quite important and also quite tricky when we are creating the table calculations. So when I said the pop-up, like again, so if I just create INDEX there,
41:14 and if I just edit the table calculation, this is the pop-up that I've been telling you.
41:22 So here INDEX is on the level of detail, but if I just take it to text you can see how the table is, uh, how the INDEX is being calculated.
41:35 So table across here clearly says that this is my furniture, this is of- office supplies, but this needs to be calculated across the table. That means for each region.
41:46 So table down is for each category, calculate the INDEX, as in give me the number, um, of… I mean, as in mark as an INDEX for each place value there. So one, two, three, four, that is table down. So across then down is again simple. So you can just out of these twelve values that we have, which is three by four matrix, you can see one, two, three, four, five, six, seven, eight, nine, is it?
42:14 It is table first is across, and then you're going down. You can see how the positioning of the INDEX is as well. One, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve. And the opposite is table down then across. So one, two, three, four, five, six, seven, eight, nine, ten, of course, twelve.
42:32 And cell is going to be one all the time because it is the position of where that particular value is.
42:39 The Specific Dimensions here play a wide role, and this is where it gets kind of complicated.
42:46 If I just say category, then it is like table across. But if you add more and more dimensions, then you will kind of face a little trickier challenge there.
42:56 Uh, so that's, that's table, um, across. So when you click on Specific Dimensions category, that means for, uh, for each region, this is Andy stumps. For each region, we are calculating INDEX by category. So that's how it is represented or that's how you can, in an English, plain English language, you can understand that this is for each region, tell me the INDEX by category.
43:23 So that's how it tells you. And if I just have region completely, then it's for the whole, whole of the table, tell me the INDEX, or whole of the dimensions that are in this view, tell me the INDEX of it.
43:38 Now, if I just change these dimensions or the order of this, you can see how they are changing the order of the position.
43:49 So previously, let's go back. I'm just moving it up and down.
43:54 So here you see that one, two, three, four, five, six, seven, eight, nine, ten, and twelve. But if I just change it to the region, you can see.
44:05 So it is calculating Y region first, and then to the, uh, category later.
44:13 So next one is
44:23 again the same, like I'll just perform a Specific Dimensions.
44:40 I think I've shown you everything there. But here if you see restarting every, meaning restarting every category, uh, change the, uh, calculation. So restart it at every category. So previously it was none, so you could see it computing across all the table, I mean, full table.
45:00 So here you see that restarted every category, meaning start again, start fresh from the new category wherever you encounter it. The sort order comes in when, for example, if I just say all of it, and if I just say from the sum of sales that we have
45:25 in the descending order, which, uh, technology tops first, right? So that, that's clearly visible here because this is the one INDEX. So based on… Because it is just a numbering. INDEX is nothing but just a numbering. Numbering is performed only on this sum of sales value at the level of category and region, and that is not restarting anywhere, but it is sorted by the sum of sales descending order.
45:53 So like that, you can just tell, uh, by simple, uh, clicking of the view, you can just say which, which one is the most, um, sold.
46:07 I think I've covered this sort order as well, and that's all.
46:13 Thank you.
46:15 Passing it on to Benjamin.
46:19 Benjamin Akinmoyeje: Yes.
46:22 It's that time again.
46:26 If you're excited,
46:29 it's swap time.
46:31 Yes, we have about a hundred and, um, hundred and eleven persons entered into this draw. So if you believe in luck, this is the time to invoke your luck.
46:43 Yes. Okay. So it's time to draw the winner. Are you ready?
46:50 Yo.
46:53 Viraj Bhargave: That's a good sound effect.
46:56 Benjamin Akinmoyeje: Yes. Dennis Lee, I hope you're around.
47:02 Yes.
47:03 How many draws are we making? One?
47:05 Viraj Bhargave: One.
47:05 Benjamin Akinmoyeje: Two?
47:07 Viraj Bhargave: One.
47:07 Benjamin Akinmoyeje: Just one. Yes, and that ends my own episode of this big event. Thank you, everybody, and you'll be reached out to, Dennis Lee.
47:17 Yeah. Thank you.
47:20 Priya Padham: Perfect. So I have the pleasure of introducing our guest speaker, Johan. So as he mentioned previously, he's a first-time Tableau Visionary this year. Yay. Congratulations. He's also a five-time Ambassador as well, which is amazing, and he is a database analyst and consultant at his company, Antichaos, which by the way, that's the coolest company name ever, Antichaos.
47:43 That is so… I love that. That's so cool.
47:46 Um, he also has an awesome blog as well, and if you haven't checked that out, you definitely should. And fun fact, if you were sitting there wondering, who on earth took that extremely professional headshot? Well, turns out it was his incredibly talented wife, and I'm pretty sure all of us want a headshot from her now. I know I do. Well, with all that be- with all that being said, I'm, I'm now going to hand it over to Johan.
48:10 Take it away.
48:12 Johan de Groot: Thank you.
48:14 Uh, and thank you, Jim and Swathi, for explanation on the difficult concepts, uh, of level of detail and table calculations. Uh, even for me, they can be still difficult after so many years.
48:26 Uh, and so now we know what LODs are and what ta- table calculations are, uh, which means you now all now in a da- most dangerous spot in Tableau. You know how both work, and absolutely have no idea when to reach for which.
48:39 That's where I come in. Uh, I'm not going to re-explain either one I'm going to show you the same handful of, uh, of questions solved both ways. Some where only one tool can work, some where both can work and pick a fight.
48:51 And by the end, you'll have a, a single question you can ask yourself every time that, that settles it.
48:57 We're not going to dive, uh, extremely deep. It's important to know what the features offer, like Jim and Swathi showed. But if you want to learn, uh, them, you've got to start by practicing with the basic options, which can be difficult enough.
49:09 So table calculations and level of detail, what to use and when to use.
49:14 Uh, this is a nice calculation with both table calculations and, uh, level of detail, but we're not going to use this one. The… But this will work. I fou- found this, and it's for each customer.
49:28 Is their pure order just the spent above the running window average? And if so, accumulate it, and if not, carry the previous value. Uh, this is far too difficult for now. Let's take some basic examples.
49:42 We'll keep it simple.
49:45 Uh, maybe, uh, it's a basic one but very important one, is the running total.
49:51 Uh, or how you might ask it, uh, if I look at the profit in Superstore for just this year, I want to see the sum of profit per month.
49:59 Uh, and if someone asked you that, it's obvious question you have to ask yourself, "What does data source know about the previous month?" Because we're looking at the previous month from this year.
50:10 And the answer is, the data source doesn't know about anything about it. It just knows dates and numbers, not positions, no order, not a before.
50:21 And when the question is about order, you're al- almost always looking at table calculations.
50:26 So let's build one.
50:30 I'll grab my Tableau Desktop.
50:38 He- There it is.
50:42 Let's build a really basic visualization with our order date.
50:49 Oh.
50:50 Maybe just per month.
50:54 And we're looking at profit, so
50:58 this is my profit per, per month, and I filtered it for… Come on, add a social filter for just this year.
51:09 I'll show you the values.
51:12 So every year, every month, we have profit. Yay, no loss.
51:16 But want to know, okay, what is the, uh, running sum of this one?
51:21 And I'll duplicate this pill just to show you, so this remains the profit for each month.
51:28 And it's very easy in Tableau. I can just click on this one, click Table Calculation, and do a Running Total.
51:36 So January is the same as the profit, but February is the value of f- of February, uh, plus January, and so on.
51:50 I can extend this one, but maybe if you look at the last two years.
51:57 Now I've got two lines.
52:00 I can do it both ways. I can say, "Okay, I want to have them both running sum." So like Swathi told us, I can say Compute Using not table across. So table across means really from the beginning of the dataset to un- until the end.
52:14 But if I say pane across, the pane is this part. It's, it's the year.
52:20 So I'll have a look at… Oh.
52:24 Compute Using pane across, and we'll see one continuous line per year.
52:32 It was mu- much more fun is if you took the year and put it on color.
52:39 Now we can s- clearly see this year and previous year.
52:44 Maybe even better, just put it on the label.
52:47 So we can see, okay, February was almost even.
52:50 The rest of year it was, uh, better than last year.
52:56 Quite easy in Tableau.
52:58 But then the question is, for all the people who love the lev- level of details, can I do this in level of details?
53:07 Uh, m- and maybe you start with, okay, with order dates and a kind of anchor date, and then you stop because it's, it's impossible to do this with a level of detail because you don't have the order.
53:20 And then you've only got the SQL mindset. "Uh, maybe I can do the SQL." And yes, it's probably possible, but you have to write something like this.
53:30 And if you look at this with order by order date, rows between UNBOUND the preceding and current row, then you're just looking at table calculations within SQL.
53:40 And this might work for you.
53:43 And then your manager asks you, "Okay, yes, but now sh- show me the running sum of sales instead of profit." And that's impossible with this one w- without changing the SQL.
53:55 While if you go to Tableau again,
53:59 I just have to change this part, and now I've got my running sum of sales.
54:06 So table calculations can be much more easy to manage than, uh, SQL statements and level of detail.
54:15 Also, changing from months to weeks is very hard. Well, I can just say, "Okay, I've got my week numbers." Now I've got my running sum per week.
54:27 Very easy. So f- for analysis, table of calculation, uh, uh, the table calculations are hard to beat.
54:35 Uh, changing from sales to profit, like we saw, it requires changing the data source.
54:39 And you can just add a dimension because we, this is now our wholesale, but maybe if we want to have a look at our categories.
54:50 I can just add it and maybe remove this one.
54:53 So now I've got runs from, from my three categories.
54:59 And if you want something else, I can just replace it by region.
55:03 Very simple.
55:07 Uh, if you want to use SQL, uh, for perf- performance-wise, it can be a very good one because it's all calculated in the database, and especially if you, uh, put it in the extract, it's very fast. But flexibility is kind of none. You have to know exactly what you're doing for your specific dashboard, and each different visualization needs its own query.
55:29 While in, uh, table calculations, they're very flexible, but performance can differ. For not too large data sets, they can be great, but for really large data sets with lots of, of data on it, uh, it, it, uh, it's, it's not as good.
55:48 So the running total proves that some of the answers we were looking for exist only when they exist in the view.
55:55 Let's now have a, have a d- look at a different example when the answer must exist before the view exists.
56:02 For example, how much of today's revenue comes from customers we won this year?
56:08 And maybe also, uh, the same question for the customers we won last year or the year before.
56:16 Uh, you m- m- might already feel the pain, I call it, uh, on the question because the manager asks you something about property of a customer when they, when did they become a customer compared to the sales from this year.
56:36 And if you look at it, uh, maybe a customer age, if you use it, it's how, uh, how we say it's how long ago since our very first order. That's defined as, uh, our age.
56:48 Uh, first you start without table calculations or, uh, level of detail, and just have look at the data and grab Tableau Desktop again.
57:03 We've got all our customers.
57:08 Our customers, yes, they order our stuff on a certain date.
57:28 And if you look at, okay, I need the first order date. So you might start by dragging order date again and have, okay, okay, I've got my minimum measure, so that should be my first order.
57:41 But on this level of detail, my order date is the same as minimum order date.
57:48 And if I remove this one and even remove my order dates, okay, these are the fields I was looking for.
57:56 But we're looking for our sales from this year, so I need to filter
58:01 on this year.
58:03 Hey, look now all my minimum order dates are from this year because we filtered out the data.
58:16 Then we can do all kind of other stuff. I'll just go back and maybe do something with, uh, table calculations.
58:27 Uh, for example, uh, I've got my order date.
58:35 That's, that's called, um, I can, uh, calculate my first order date, but still you got the problem with, uh, the fact that you need all your data. So for just the analysis of this year, you need to have the data for all orders and all order dates for all customers.
58:53 You don't want to do that.
58:55 So
58:59 you want to avoid this. I've put it… Or the window min of minimum order date.
59:07 This is my table calculations with the computer using table down. So my first order ever was, uh, on this date.
59:16 And if I want to know the first order for each customer, I can select my pane down.
59:24 But I need to remove my order date and my, uh, customer name. But still, I need to add all this data, and I can't filter for this year.
59:41 So let's have a look at the, a better way, and now we finally get into the level of detail.
59:46 I create a calculated field. This is quite large.
59:49 It's my first tab rule, first order date per customer.
1:00:03 And the squiggly bit.
1:00:05 And I say, "Okay, I fix my level of detail," and I want to know per customer was your first order date.
1:00:27 I'll put it here, and it's on here, but just to be sure, uh, exact dates.
1:00:36 Distract.
1:00:38 And look, I've got my first order date for each customer while my data is filtered on just this year.
1:00:47 My level of detail doesn't change. Uh, the data, the filter doesn't change the, the outcome of the, uh, level of detail calculation.
1:00:56 And with this quite simple calculation, I can say, "Okay, I've got my sales.
1:01:03 These are my customers and my first order date." But if I remove my customer names
1:01:09 and put this on
1:01:12 here, so now I can see for 2016…
1:01:19 Let's have a look just to be sure. Look, I'm just looking at order dates on 2026.
1:01:25 Uh, these are my s- my s- these are my sales from customers who became customer in 2023, 2024, '5, and '6.
1:01:36 So these are my first time, uh, buyers from this year.
1:01:43 And for analysis, I can say, "Okay," with a small table calculation, I want to know my percent of total.
1:01:54 I show it.
1:01:55 So 50%… 55%, 54% of my customers from this year have been become a customer in 2023.
1:02:04 So you might say it's a liability that, uh, we've got some loyal c- customers but a few new ones.
1:02:12 I can even say, "Okay, I put my, uh, year away," because I just want on this one, and put on color.
1:02:20 And look, now I've got a simple bar. These are my values, 2023, 2024, '5, and '6.
1:02:30 Okay, let's have a look at another one.
1:02:34 Ranking.
1:02:37 Uh, ranking can be difficult because everyone thinks it's instinct that the rank feels like a fact about the data.
1:02:44 Um, for example, again, look at the dataset. I've got my subcategories.
1:02:52 I've got my sales.
1:02:57 I did some pre-work. Okay.
1:03:02 So how, uh…
1:03:06 If you look at this and I ask you, "Okay, what rank is phones?" I hope you all say, "Okay, it's number two." But then my second question is, "How do you know that?
1:03:16 It's somewhere in the data?" Uh, no, it's a statement about phones relative to the 16 other bars.
1:03:24 If I change the sub- subcategory to country,
1:03:30 you've got a completely different list.
1:03:35 So if you change the bar, you change the rank.
1:03:38 Uh, so rank isn't a, a property of the row, it's the property of the l- lookup.
1:03:46 And because it's also about order, we have to look at table calculations.
1:03:50 So how do we do that?
1:03:54 It's not the most easy one, but not too difficult. I duplicate my sum of sales.
1:04:00 You also have to think, "Okay, I'm going to want to rank my subcategories by sales," so my rank is on sales.
1:04:07 So I've got my sales.
1:04:10 Click down, click Table Calculation.
1:04:13 I've got my rank.
1:04:16 And look,
1:04:20 I put it on Label, one, two, three, four, five are all here.
1:04:26 So this is my sales, and this is my rank on sales.
1:04:34 But this doesn't look nice, so what I can do is I'll change this one to Discrete and move it to the left of Sub-category.
1:04:47 So I've got now my list with all my sales, and this is my rank.
1:04:53 And what I always like about, uh, Tableau is you can format it. So if I format a da- date, I go to my numbers in my header.
1:05:03 It's a rank, so I put a hash sign in front of it, so it's number one, number two, number three.
1:05:11 And then what can we do more with this? Uh, the power of, uh, the table calculation is because they're flexible, we saw before. So maybe I want to know my, uh, ranking of my subcategories per sale, uh, per region. So I put Region on the Columns, and then I've got this ugly visualization. Something goes wrong.
1:05:38 What happens? Yeah, uh, Tableau is doing some ranking. This is still my number one, but this is also number one.
1:05:46 Um, if I go back, you can see, okay, this one shouldn't be here because Chairs, Phones, and Storage is now one, two, and three, but this order isn't, uh, being used on subcategories.
1:05:58 So I'll drag my Sub-category to the Detail.
1:06:02 Now we've got this interesting bar chart.
1:06:06 My sum of sales, if I look at the addressing, it's gone. But so if I say Edit Table Calculation, it's now on the Table Down, but there is no down.
1:06:17 But if I click on Specific, uh, Dimensions, look at this.
1:06:21 Look, now it's on Sub-category again because my subcategory is on my detail.
1:06:29 And now I'll drag my Region again to my Columns.
1:06:36 Chairs, Phones, Binders. Phones, Chairs. So different, uh, subcategories per region. But of course I want to show them, so what I'm going to do, I'll put my subcategory on the label.
1:06:53 And I did some preparation. So what I usually do is, because my ranking is more important than the value of my sales in this case, I'll drag my opacity down very low I put on a, a, a light border.
1:07:10 And what, what we already did, the alignment to the left.
1:07:15 So this more like a table with all my subcategories.
1:07:19 And in the back, in the background, you can see, uh, you, you can still see the sales for e- for everyone. In the Central my phones is on number two, and in the East my phones are number one.
1:07:34 And can I do this with LODs? Ugh, again, it's hard to do this because, uh, LODs don't know about order.
1:07:42 You can start with a fixed, uh, on subcategory and sum of sales, then, uh, try to rank this hard.
1:07:49 And a while ago, I tried to do the same with sets.
1:07:53 I had to create a, a, a top 10, but then I need to, uh, create a set for every element in my, uh, in my, uh, in my set.
1:08:02 And, uh, it was a lot of work and you do- don't get, uh, a li- a list, but only the number two or the number three.
1:08:12 So ranking with table calculations is much, much more powerful.
1:08:18 Uh, oh, we already saw this.
1:08:21 Um,
1:08:24 about the ad- a- addressing.
1:08:27 And I must admit, this is the hardest part of, uh, table calculations, because you're just clicking, and if it works, you just leave it there and you hope it, it, it will stay there.
1:08:45 Another question from another manager. "Okay, can you show me the weakest sales rep, but only for our best customers?" And they will ask, "Oh, what's… Which are our best customers?" And then your ma- manager asks you, "Okay, my best man- my best customers are our customers w- w- who, uh, who have spent at least $5,000, uh, in the, uh… ever."
1:09:12 And then you sort of think and like, "Okay, that's easy. I just, uh, grab my sales and I filter on all my sales with at least $5,000."
1:09:28 And what happens now? Only my weeks without, uh, $5,000 of, uh, sales have gone, and it's all the same.
1:09:42 And that's hard.
1:09:45 And it just sh- shows you nothing. It's… It doesn't show an error because it's just what you ask.
1:09:51 You ask for, uh, uh, T- Tableau, "Okay, give me my, the number of sales with sales of at least $5,000."
1:10:04 And look at what we got. It's just only showing me the weeks for sales past the 5,000. Uh, that's a real answer, and Tableau didn't warn us.
1:10:14 Uh, and then we have to look at the original question again. We want to have a look at our customers who have sold, which have bought for at least $5,000.
1:10:24 So that sounds really like a table calculation, so we call them our best customers.
1:10:35 And again, a fixed calculation. I want to calculate per customer my total of sales.
1:10:44 The total sales doesn't care about the rest of, uh, of my, my, of my view.
1:10:50 It ca- calculates really in front, uh, when the view loads. Before the front, that the view loads, uh, it calculates
1:10:58 this.
1:11:00 And have a look at this. I've got my, uh… These are all my customers,
1:11:07 and my total sales per, per customer.
1:11:15 And I created this one.
1:11:18 So if my total sales per customer is over 5,000, then I want to keep them. This is a bullion.
1:11:25 Let's have a look at this one. I put this one on color.
1:11:29 So Adam, Adrian, and, uh, Ellen, congratulations.
1:11:32 You spent over $5,000 with us, and the rest not.
1:11:36 So if I go back to this visualization, I can filter or just put it on color. Let's start with putting on color.
1:11:45 So these are all my sales from customers with sales of over $5,000 overall in this year.
1:11:58 So if you put it on filter and click okay, this is meager answer.
1:12:16 Okay, let's have a look at this one.
1:12:20 Percent of total, also a famous one.
1:12:24 Um, how much sales did California, for example, compared, uh, to all sales?
1:12:29 And we can do this in two different ways.
1:12:36 Uh, level of detail.
1:12:38 Sum of sales divided by the fixed number of sum of sales.
1:12:43 And this one, this fixed number of sales is just overall sales ever.
1:12:48 Or if you look at the table calculation way, uh, I can, uh, drag it from my pill or just type it down. Sum of sales divided by the total sum of sales.
1:13:00 They got the same answer.
1:13:02 If I go to
1:13:06 Tableau, it almost fits my, my, uh, resolution a bit, uh, too- Small or just…
1:13:16 Yes.
1:13:19 Maybe even.
1:13:24 So no one is forgotten.
1:13:26 This is a table with my sum of sales, uh, compared to my total sum of sales as level of detail. This one is my, uh, is a table of, a table calculation.
1:13:39 As you can see, they're exactly the same numbers.
1:13:44 So should, what should I choose? And maybe if I starting to, uh, filter the data, I've got, for example, subcategories or my region. Let's start with the region. If I only look at my west region,
1:14:02 California is, in my level of detail part, still about twenty percent, while in my table calculation part it's ab- above sixty percent.
1:14:13 So what happened?
1:14:15 This table calculation
1:14:19 calculates the value
1:14:22 of California as my sum of sales of California divided by my whole set, so it's both US and Canada.
1:14:31 What if I go to my table calculation?
1:14:36 I filtered my data, and my total sum of sales is a, is the sum of sales which is shown in the, in the view. So only the west part of the country.
1:14:50 But the question is, what do you need? Do you need to, uh, zoom in, uh, into a specific data set?
1:14:57 Oh, um, if I…
1:15:01 No, there. Okay.
1:15:03 It's a different one. If I only go to West, click.
1:15:09 Do you want to see the, uh, the total, uh, sales of California compared to my whole data set or only in my view?
1:15:17 And that's one of the main reasons why you choose either a table calculation or, uh, level of detail.
1:15:25 And of course, they can also be, uh, changed. If I use my, uh, add to context filter, uh, in my level of detail, I can also zoom in. But this is one of the, the basic, uh, ways of looking at these kind of calculations.
1:15:43 Last one, year over year.
1:15:46 How we're doing compared to last year, and that's probably, uh, told by every manager, uh, every month.
1:15:54 And
1:15:57 we're using Tableau, and you're very proud of it.
1:16:01 So you say, "Okay, I've got my sales.
1:16:06 I've got my year.
1:16:10 Look, manager, th- this is how we're doing." And then, of course, you ask, "No, no, that's not I want. I just want a number. Just a single number."
1:16:24 And that we can do it on different ways. If I use my level of detail way, I have to create some calculations.
1:16:34 I'll first start with…
1:16:36 I'll put this here.
1:16:39 Uh, for example, my fixed, if my year from order date is, is the year from today, then my number of sales. So this will get, uh, my order date from this year.
1:16:51 Or maybe I want to do it a bit, uh, better, then I use the latest order date in my dataset.
1:16:59 And yes, you can use a level of detail calculation within a different level of detail calculation.
1:17:07 So you can nest them again and again.
1:17:10 Uh, same as table calculations. You can also nest them. For example, you can do a, uh, a push of total of… A running total. You can use LODs within table calculations.
1:17:23 You can't use table calculations inside an LOD. That's because of the, the order of operations.
1:17:28 You remember on, uh, on the top of the pyramid are the LODs, and re- on the bottom are the table calculations.
1:17:39 Create a similar calculation for, uh, sales from last year. It's about the same, only we look at the year minus one of my order date.
1:17:56 And I'll combine these two calculations with my sales this year, minus s- sales last year, divided by my sales last year.
1:18:05 Three different calculations.
1:18:08 And for the table calculation, it's this. It's much simpler, but you need to have, uh, need to do more work on it. Sum of sales minus the lookup of my sum of sales from the previous value, previous cell, divided by, uh, by the same lookup value.
1:18:27 So
1:18:30 if I use this one, and I'll show you this calculation.
1:18:35 This year minus, uh, last year divided last year, and you can create a beautiful BAN out of it, big ass numbers.
1:18:44 You can just use it everywhere you want to because it's just in the dataset.
1:18:49 Uh, same for the table calculation, uh, variant.
1:18:55 So what you can do, this is my, uh, calculation.
1:19:01 But if I just filter this one to twenty twenty, uh, six, nothing is left because there's nothing to compare it with.
1:19:12 So what can we do?
1:19:15 And we saw, uh, uh, also the, uh, last function.
1:19:20 So if I use my last function
1:19:25 So here last and make it discrete.
1:19:31 Last, if you remember, it's the number of steps until the last part. It can be vertical or horizontal.
1:19:37 So this year is n- is n- is null, zero, one, two, three.
1:19:44 So what I can do is I'll create a small
1:19:49 calculation,
1:19:52 last equals zero.
1:20:04 A Boolean, and I put it on my filter and say, "Okay, it's true." So I want to keep only my value if the last is zero.
1:20:16 And now it's still there.
1:20:19 Why?
1:20:20 Because a, a table calculation filter is not a data filter. It's more like a view filter.
1:20:25 Tableau still knows about the, the previous values.
1:20:30 So we have to do more for this. It's not just a single drag.
1:20:33 Uh, but you can enhance this one with the simple, uh, extra calculations. What I did here was I've got my different sales, but I can also say, "Okay, look at my previous value and look at value even for the year." So I got a small but powerful, a BI- biggest number.
1:20:55 My 2026 sales are plus 21%.
1:20:59 That's 745K versus 613K in 2025. And so you can enhance this one. And if I remove the last function, you can see my previous one once.
1:21:12 But because of this one, you've got a small but powerful KPI.
1:21:22 So, uh, I think for most of us, uh, both level of detail and table calculations, we have kind of a love-hate relationship.
1:21:30 Uh, we love table calculations because they're extremely fast to reach. Just click, click, and you've got something.
1:21:35 Uh, you can change them for year, month, uh, weeks, and it answer really the questions you are looking at.
1:21:45 Uh, in person with LODs, uh, they're se- self-contained. Y- it's just a, a data, it's a number. You can use it. It behaves like data. If you're used to SQL, level of detail feel more, much more, uh, like you're used to, and it answers about the whole dataset, not about what you're looking at.
1:22:05 But, uh, of course, uh, there are some downsides of level of details. You need, uh, lots of fields to build. Uh, you need to name them, maintain them.
1:22:14 I just showed you fixed, but you also got include and exclude.
1:22:18 Uh, maybe you need a different one, and you need to, uh, create, uh, lots of assumptions.
1:22:25 Uh, table calculation on the end, they can be horrible because of the a- a- the addressing.
1:22:31 I'm computing something, uh, something across what?
1:22:35 Uh, and if I hide something, it's not a filter, but it's really hiding.
1:22:41 And if it fails, maybe it's, it's better, it fails loudly. I just got blanks. While if, if an LOD fails, you can get just a wrong number.
1:22:53 So, uh, love LODs, love table calculations, and love them responsibly.
1:22:59 Uh, try them both. Uh, be creative.
1:23:01 Uh, open your dashboards, have a look at current, uh, calculations. Maybe replace them with table calculation, replace one with a level of detail.
1:23:12 Uh, switch them. Uh, get it wrong.
1:23:16 Have a look at why it's got, got it wrong, and dive into all the options, uh, like we, we saw before.
1:23:23 Uh, if you've got any questions, remarks or whatever, uh, please contact me. Uh, here are some, uh, ways you can find me. You can also reach me just personally, but also on the blog or LinkedIn. Uh, and thank you very much, uh, DR, uh, Tableau and UB group.
1:23:39 Jim Dehner: Well, thank you ver- thank you very much.
1:23:42 Uh, I learned a lot today. I learned a few things. And, uh, Swathi, to answer your question, I'm an LOD person, uh, clearly.
1:23:51 And we really, uh, we really appreciate what you showed us today, Johan.
1:23:55 Maddie, are you about ready with that quiz?
1:23:59 Madeline Wild: I don't know why it's not showing us the responses, but both include and exclude would be impacted by dimension filter because they come after…
1:24:08 Oh, I'm so sorry, that says dimension field.
1:24:11 It should be dimension filter. I'm gonna fix one with that.
1:24:17 Table calculations are pulling their data from the data source or the data in the view.
1:24:23 Which one is true?
1:24:30 Viraj Bhargave: I'm loving these questions, Maddie.
1:24:32 Great job.
1:24:33 Madeline Wild: Thank you. Laura helped me with the questions also. Thank you for reminding me-
1:24:37 Jim Dehner: Oh, nice
1:24:37 Madeline Wild: … to our pa- pay half your audience member.
1:24:41 Okay, we're not quite halfway, but we're about halfway, so we've got an early leaderboard here. Way to go, Cindy, and Steven, and BB.
1:24:48 Um, a table calculation is pulling from the data that's in the view. That's why it's called a table calculation.
1:24:55 If you need a calculation available across multiple sheets, what field should you use? A calculated field, a table calculation, or a quick table calculation?
1:25:08 You should use a calculated field. Oh, Steven is ranked at the leaderboard. Way to go, Steven.
1:25:15 Calculated fields persist, but table calcs don't.
1:25:18 Dragging and dropping a field on your sheet will change the level of detail.
1:25:24 That should be fixed level of detail
1:25:33 Uh, the answer is false. It will change your table calculation. So when Johan did that, he was using a table calculation, and that's why it was changing. But unless it's, um, um, actually mentioned in your…
1:25:48 It's the context filter. So there's like a really small chance that that could happen, but it would have to be a context filter that's included, and you know, it's not, it's not the example that was given. Johan did it with a table calc.
1:26:04 You can change the direction and scope of a table calculation, true or false?
1:26:10 Swathi gave us so many good examples of if you could do this or not.
1:26:18 You absolutely can, and you should to get what you want out of your table calculation. All right.
1:26:27 If you want a percent of sales visualization that's interactive through filter use, which method should you choose?
1:26:35 Fixed LOD, table calculation.
1:26:38 Viraj Bhargave: Oh, this one's tricky.
1:26:40 It's, it's kind of asking which team you're from.
1:26:44 Madeline Wild: Yeah. Actually it's, it's not doing that. Everybody has a place.
1:26:49 Viraj Bhargave: Yes. It depends.
1:26:51 Madeline Wild: It does depend. Table calc.
1:27:00 Okay. Which calculations can you nest together? Two table calculations, a table calculation inside a fixed LOD, or a fixed LOD inside a table calculation. So this is like, have you totally mastered both order of operations and fixed LODs and table calcs?
1:27:18 Have you done it?
1:27:20 The final boss, if you will.
1:27:24 Okay, you can put a LOD inside of a table calc, but you cannot put… I don't know why it's giving me gray screens.
1:27:34 Okay. Uh, because there's multiple answers that you could pick, I think that's why it's not showing me that. But you can put, uh, two table calcs together, and you can put an LOD inside a table calc, but you cannot put a table calc inside an LOD. There we go. That's like a tongue twister there.
1:27:50 Okay. And then our most important question here, if you take nothing away from today, what famous photographer took Johan's headshot?
1:28:00 Viraj Bhargave: I love the options.
1:28:02 Madeline Wild: I'm pretty sure Ansel Adams is no longer with us.
1:28:08 But the other three definitely are.
1:28:13 It was his wife.
1:28:14 Viraj Bhargave: She, she just arrived.
1:28:17 Madeline Wild: All right. Congratulations, Steven Booth. I'm going to DM you, and um, I need you to share some information with me so I can send you your swag prize. But thank you everyone for playing along with us.
1:28:33 Hmm.
1:28:34 Jim Dehner: Okay. Thank you for, uh, thank you for playing along. I liked that last question a whole lot.
1:28:40 Hey, remember on September the 2nd, we're gonna have our next meeting. It's the fifth stop along the way, and Dennis Cowell is gonna be with us, and we're gonna be talking mapping. Everybody loves maps.
1:28:50 And in addition to that, uh, Priya's gonna be talking, and everybody loves Priya, so there's no reason not to attend. And as a matter of fact, you can sign up right now. Uh, we're gonna leave this up for a second. You can use that QR code to register, uh, register today. Thank you for attending today. We're looking forward to seeing you in September.