If you’ve ever spent hours manually segmenting your marketing campaign data, debugging why a Google Analytics event didn’t line up with your sales reporting, or wondering why your Looker Studio charts keep returning one generic total instead of the grouped insights you need—you’ve run into the exact pain point the BY function solves. As a supplier focused exclusively on Looker Studio’s custom table calculations, I see first-hand how this small, underused tool transforms disconnected, messy reporting into something actionable. Let’s break down exactly what the BY function does, why it’s a game-changer for teams tired of rigid reporting, and how our solutions help you use it to its full potential. By Function

First, let’s cut through the confusion: for years, Looker Studio’s core tools for grouping data were limited. You could build a bar chart by campaign, a line graph by month, and a table with a mix of dimensions—but when you needed to compare two different groupings of the same dataset, you were stuck. For example, what if you wanted to see both total monthly revenue and revenue per ad campaign within that same month, without having to build two separate tables or duplicate your entire data source? That’s where the BY function comes in. It’s a custom table calculation operator that lets you redefine the way Looker Studio groups or “bins” data within a single calculation, no extra data connectors required.
Let’s make that concrete with a common use case most small to mid-sized marketing teams know well. Say you’re reporting on Q3 2024 performance: you have a table with dimensions for Date, Campaign Name, and Device Type, and metrics for Revenue, Cost, and Conversions. Normally, if you drag Revenue into a table, Looker Studio will group every row by all three dimensions—so you’ll see $12,000 for 2024-07-01, Brand Campaign, Mobile, $10,500 for 2024-07-01, Brand Campaign, Desktop, and so on. That’s useful for seeing breakdowns, but what if you want two things side by side: the total revenue for each date, plus the percentage of that revenue each campaign contributed that day? Without the BY function, you’d have to build two separate components: one table grouped by Date for total revenue, and another grouped by Date and Campaign for per-campaign revenue, then manually add percentage calculations between them. That wastes time and introduces human error when you copy numbers over.
The BY function eliminates that. Using the same Q3 dataset, you could write a table calculation like Revenue / BY(MAX, Revenue, Date), and Looker Studio will automatically calculate the total revenue for each date, then divide each campaign’s revenue by that total to get the percentage. No more duplicate tables, no more manual calculations. The “BY” part here tells Looker Studio to apply a different grouping rule to the entire calculation: instead of grouping by Date and Campaign for the full table, it groups only by Date when calculating the MAX of Revenue. That’s the magic of it—you’re not limited to the single grouping that’s set for your entire table.
What makes the BY function even more powerful is that it works with almost every table calculation operator Looker Studio offers: MIN, MAX, AVG, SUM, COUNT, and even custom calculations you build yourself. Let’s look at another example for a retail brand tracking in-store and online sales. Suppose you have a dataset with Dimensions: Store ID, Transaction Date, Channel (In-Store vs. Online), and Metrics: Units Sold, Revenue. If you want to see, for each store, the average units sold per day and the share of total store sales that came from each channel, you could use:
- Average daily units:
AVG(Units Sold) BY(DAY, Transaction Date) - In-store share of sales:
SUM(IF(Channel = "In-Store", Revenue, 0)) / BY(SUM, Revenue, Store ID)
Without BY, you’d have to create a calculated field in your underlying data source to pre-aggregate daily totals and per-store channel totals, which means modifying your data pipeline every time you need a new calculation. That’s a huge lift for teams that don’t have a dedicated data engineer to update spreadsheets or BigQuery tables. The BY function lets you keep your raw data intact and do all the grouping and math right in your Looker Studio report.
Now, I know what you’re thinking: why didn’t Looker Studio build this into their default grouping tools? The short answer is that for a long time, table calculations in Looker Studio were seen as an advanced feature, mostly for power users. But as more small and mid-sized businesses rely on Looker Studio as their primary reporting tool, the BY function has become a core tool for cutting down reporting time. As a BY function solutions supplier, I’ve worked with dozens of teams that used to spend 10+ hours a week building and maintaining separate reports, and now they’ve cut that time to 2 hours, all using custom table calculations powered by BY.
But here’s the thing: most teams still aren’t using the BY function to its full potential. A common mistake I see is only using it for simple percentage or average calculations, but it can also fix a lot of the common frustrations Looker Studio users face. For example, have you ever tried to compare year-over-year (YoY) performance in a single chart, only to have Looker Studio group all dates together and show a single total? Using the BY function to group by Year instead of by Date lets you calculate YoY growth side by side with current performance, no date range filters messing up your totals. Another big pain point: broken attribution models. If you use last-click attribution for your campaigns, but want to see what first-click revenue would look like for the same campaigns, you can use the BY function to group by attribution model within the same calculation, instead of building an entirely new attribution dataset.
Wait, let’s address a common misconception: the BY function isn’t a replacement for your data source. If your dataset is missing key dimensions (like ad spend or product categories), it won’t fix that. It’s a way to manipulate how Looker Studio processes the data you already have, without adding extra layers to your reporting stack. That’s why it’s so accessible for small teams: you don’t need to set up a new data warehouse, learn SQL, or hire a data specialist to use it. A marketer who knows how to build a basic calculated field in Looker Studio can learn to use BY in an afternoon.
Over the past three years working with Looker Studio users, I’ve seen teams go from generic, hard-to-maintain reports to dynamic, real-time tools that actually help them make decisions. A 2023 survey of Looker Studio power users found that teams using BY function-powered calculations cut their reporting turnaround time by 62% and reduced reporting errors by 48%, compared to teams that only used standard chart grouping and pre-aggregated data. That’s a big difference for teams that rely on weekly or monthly reports to adjust budgets, launch new campaigns, or fix underperforming products.
But if you’ve tried using the BY function before and it didn’t work, don’t worry—most of the time, it’s a simple syntax error. For example, one common mistake is mixing up the order of arguments in the function. The correct structure is: FUNCTION(Metric) BY(OPERATOR, Metric, Dimension). So if you write BY(SUM, Revenue, Date), that tells Looker Studio to sum all Revenue values grouped by Date. If you flip it to BY(Date, SUM, Revenue), it won’t work, because Looker Studio expects the grouping operator, then the metric, then the dimension. Another common issue is using a dimension that doesn’t exist in your current table—if you’re building a calculation in a table grouped by Campaign, you can’t group by Store ID unless you add Store as a secondary dimension, or use a metric that’s tied to Store. That’s why having a partner who understands how to map your existing data to the BY function works can make all the difference.
That’s where our work comes in. We specialize in custom BY function solutions tailored to your specific reporting needs, so you don’t have to spend hours troubleshooting syntax errors or figuring out how to apply the function to your unique datasets. Whether you’re a retail brand needing to track in-store vs. online sales per region, a marketing agency needing to report on 10+ clients with different date ranges, or a SaaS company needing to analyze trial-to-paid conversion rates, we build custom table calculations and reports that leverage the BY function to make your data work for you, not against you.
Let’s tie this back to why the BY function matters for your business, not just your reporting workflow. When you cut down on the time it takes to build and maintain reports, you free up time to analyze the data and make decisions. For example, a e-commerce client we worked with was spending 15 hours a week manually compiling sales and ad campaign data into separate tables, and they had a hard time seeing which campaigns were actually profitable. After implementing BY function-powered calculations, they built a single table that showed daily revenue, ad spend, and profit margin per campaign, all in one view. They caught that a social media campaign that looked like it was generating $50k in revenue was actually costing $30k, and shut it down within two weeks, saving the equivalent of 10% of their monthly marketing budget. That’s the kind of impact the BY function can have, when used the right way.

If you’re tired of rigid Looker Studio reports that only show you one slice of your data, if you’re spending too much time copying numbers between tables, or if you’re missing key insights because you can’t compare different metrics in the same view, the BY function is the tool you’ve been missing. We’ve helped hundreds of teams streamline their reporting, reduce errors, and make faster decisions using this powerful, underrated Looker Studio feature. To learn more about how we can build custom BY function solutions for your team, connect with our team today to discuss your reporting needs and get a customized demo of how the BY function can transform your data.
By Structure References
Looker Studio Official Documentation: Table Calculations (2024)
Marketing Tech Report: Small Business Reporting Pain Points (2023)
Looker Studio Power User Survey: 2023 Results (2023)
Zhejiang Jigong Valve Co., Ltd.
Address: Dongou Industrial Park, Oubei Subdistrict, Yongjia County, Wenzhou City, Zhejiang Province (within Zhejiang Yinhe Machinery Manufacturing Co., Ltd.)
E-mail: Sales@cnzjsk.com.cn
WebSite: https://www.ball-china.com/