Skip to main content

BI Project Scenario

Scenario

You are a BI analyst for a grocery store chain monitoring dietary trends that influence in‑store purchases. Your company wants you to analyze which types of Hass avocados are purchased most often. Avocados are categorized into four sizes—small, medium, large, and extra large—and each sale includes the average price, total volume, and date.

Using this dataset, you will create a historical table to demonstrate how partitions and clusters work in BigQuery. Your goal is to answer the question:

What is the distribution of avocado sales from 2015 to 2021?

Create a Baseline Table (No Partition, No Cluster)

Start by creating a new table without partitions or clustering. This baseline will help you compare performance later. Name the table avocados.

BigQuery interface showing SQL editor

After running the SQL, your table should look like this:

BigQuery table preview for baseline avocado table

Create a Partitioned Table

Next, create a table partitioned by an integer range representing the years 2015–2022. Name this table avocados_partitioned.

Return to the SQL editor, delete the previous query, paste the new SQL, and click Run.

BigQuery partition creation example

Your partitioned table should now appear like this:

BigQuery partitioned table preview

Create a Partitioned and Clustered Table

Now create a table that is both partitioned by year and clustered by type. Name this table avocados_clustered.

BigQuery clustered table creation

The resulting clustered table should look like this:

BigQuery clustered table preview

Query the Tables and Compare Performance

Query the Non‑Partitioned Table

Querying non-partitioned table in BigQuery

Query the Partitioned Table

Querying partitioned table in BigQuery

Query the Partitioned and Clustered Table

Querying partitioned and clustered table in BigQuery

Visualize the Results

Number of Avocados Sold per Year

Chart showing number of avocados sold per year

Total Volume per Year

Chart showing total avocado volume per year

Average Price per Year

Chart showing average avocado price per year

Conclusion

By creating baseline, partitioned, and partitioned‑clustered tables, you can clearly observe how BigQuery improves performance through efficient data pruning and clustering. Partitioning reduces scanned data, while clustering improves filtering and sorting within partitions.

This workflow is essential for BI professionals working with large datasets. For more foundational concepts, explore:

With partitions and clusters, you can deliver faster insights, reduce costs, and scale your analytical workflows efficiently.

Comments

Popular posts from this blog

Alfred Marshall – The Father of Modern Microeconomics

  Welcome back to the blog! Today we explore the life and legacy of Alfred Marshall (1842–1924) , the British economist who laid the foundations of modern microeconomics . His landmark book, Principles of Economics (1890), introduced core concepts like supply and demand , elasticity , and market equilibrium — ideas that continue to shape how we understand economics today. Who Was Alfred Marshall? Alfred Marshall was a professor at the University of Cambridge and a key figure in the development of neoclassical economics . He believed economics should be rigorous, mathematical, and practical , focusing on real-world issues like prices, wages, and consumer behavior. Marshall also emphasized that economics is ultimately about improving human well-being. Key Contributions 1. Supply and Demand Analysis Marshall was the first to clearly present supply and demand as intersecting curves on a graph. He showed how prices are determined by both what consumers are willing to pay (dem...

Fundamental Analysis Case Study NVIDIA

  Executive summary NVIDIA is analyzed here using the full fundamental framework: balance sheet, income statement, cash flow statement, valuation multiples, sector comparison, sensitivity scenarios, and investment checklist. The company shows exceptional profitability, strong cash generation, conservative liquidity and net cash, and premium valuation multiples justified only if high growth and margin profiles persist. Key investment considerations are growth sustainability in data center and AI, margin durability, geopolitical and supply risks, and valuation sensitivity to execution. The detailed numerical work below uses the exact metrics you provided. Company profile and market context Business model and market position Company NVIDIA Corporation, leader in GPUs, AI accelerators, and related software platforms. Core revenue streams : data center GPUs and systems, gaming GPUs, professional visualization, automotive, software and services. Strategic advantage : GPU architecture, C...

Behavioral Portfolio Theory (BPT) – Rethinking Investor Behavior and Portfolio Construction

  Traditional finance theories like Modern Portfolio Theory (MPT) assume that investors are perfectly rational and risk-averse, aiming to maximize utility by optimizing expected returns and variance. However, decades of research in behavioral finance have shown that investors often deviate from purely rational behavior. Behavioral Portfolio Theory (BPT) , introduced by Shefrin and Statman in 2000, offers a fresh perspective by integrating psychological and emotional factors into portfolio construction. What is Behavioral Portfolio Theory? Behavioral Portfolio Theory suggests that investors mentally segment their wealth into multiple “mental accounts” or layers, each with distinct goals, risk preferences, and expectations. Unlike MPT's single-layer approach focusing on an overall risk-return tradeoff, BPT models the portfolio as a layered pyramid , where each layer reflects different investor aspirations. For example: The bottom layer prioritizes capital preservation and safe...