
Visualization Layers Aggregation
Rob walks through a fix for the "aggregate on aggregate" problem in Layers, where averaging pre-aggregated values produced jagged lines. Shows how the viz now automatically detects the…
Transcript
This transcript is auto-generated. Names and product terms may be wrong.
Ariel. I'll leave that to Peter and Daniel. Drop it. Steeply. We have Jamie here now . But yes, once we're online, people start coming back. Rob, you're first, unless you're waiting for someone else to... No, I was just waiting, I just wanted you to sit in awkward silence for a minute. OK. We can have a moment of awkward silence if you want.
I would do it again . That's why I'm here. So, this is probably going to be a long story. So get ready. I've been working on layers for a while now, and one of the main problems we're trying to solve goes something like this . You have two indicators, one separated, the other not, on the same chart.
The problem is that the query looks something like this. This looks good and works for calculations, but if you have something like a mean, you can't of course calculate the mean from the mean. This is called the aggregate aggregation problem. And this is what you get . You've probably seen this in our visualizations where the lines become broken because you're actually plotting two points on one X point.
Will, thanks again to Will, spoke out against what we were doing before, which was this aggregation of aggregates in layers. So I dedicated this week to working on it and seeing what would come of it. I don't know if we should try to do it a little better. It turns out that many of our tables have extensive support for such things.
So now if I take the margin, which is now the average, I'll plot it on the axis and make it visible. You see that the table has automatically added a total. And from that moment on, it pulls up these values, I do n't know why they're not in my prompt. Probably because I deleted it earlier. But now we actually build averages at the warehouse level by simply adjusting the visualization configuration.
And you can also have another format, such as a pivot table. Functionally, it's the same diagram. But the query is configured a little differently. And if you do the same here, the results, of course, won't work. You need row-by-row summaries. And so they, so to speak, connect instead of them. And we're working on it, but we'll get there.
So now, since I probably touched on them before, I removed my prompts, but now we do the same thing here when you have something like a pivot table. So what we do is the visualization now understands the form of the required query and adjusts it as it works. And it can get quite complicated if you make, for example, a trellis diagram.
So if I take that and make a trellis by country, oh, and I should have added a margin there. Now she needs to understand that there are several levels of detail, let's say , for a query. So, first, she needs to know that this should be the average of both the country and the date for each of them, and that's exactly what she does.
Well, not exactly "something", it's just what she does. And it gets a little more complicated because you can remove the country, and if I want to select gender instead, you'll see that the table has resorted to support that. So she actually knew that she needed to ask for a different level of detail, she supplemented the query, she did it , and now you get a different average.
So the visualization has this understanding of what it needs, and it builds that into the query in the workflow when it requests the data. And it produces nice results for some things. You've probably often seen charts where there is only one indicator. And if I wanted to plot my average on it, we would have segmented columns , but now we don't have them because the system knows that I want one average for each point on the X-axis.
So it came out quite naturally because the visualization understands that, which is pretty good. And then you can have things like orders where there are these extra dimensions , and you don't have that zigzag line. It simply understands that each point on the X axis must have its own point, and automatically sums it up. So, yeah, those are some things we're working on .
Well, this instance is running if you want to play with it. I'll add this, it's in the project visualization layers . Well, just look there. Eh, but it's starting to come out, so ... This, this is great and just so relevant. You guys did a great job. I am so excited. Oh, don't go. I'm going to ask a question that , uh, Jamie, you're probably wondering , Rob, what, does this work with SQL queries as well?
Or how would it interact with the SQL database, I...we may not have tried that yet . even this. I haven't tried this. I have no idea . I stopped at the point where I'm asking for the code, so... That's cool. This is really cool. This is a huge, huge advancement on the visualization front, like, uh, if I never see a jagged line again in my life, I'll be very happy.
We will try. Very good.