Pivot Tables and Curve Fitting
Create pivot tables with rows, columns, values, and aggregation—and fit curves (linear, polynomial, exponential, logarithmic) with R-squared interpretation.
Pivot Tables and Curve Fitting
Pivot tables summarize and reshape your data. Curve fitting finds mathematical relationships between variables. Both are essential for reporting and analysis.
Pivot Tables
What Is a Pivot Table?
A pivot table turns long, detailed data into a compact summary. You choose which columns become rows, columns, and values—and how those values are aggregated (sum, average, count, etc.).
Why Use Pivot Tables?
| Use Case | Example |
|---|---|
| Summarize by category | Total sales by region |
| Cross-tabulate | Count of orders by product and month |
| Compare across groups | Average rating by customer segment |
| Spot patterns | Revenue by year and quarter |
Creating a Pivot Table
#### Step 1: Choose Rows
- Rows = the categories that become row labels.
- Example: Region, Product, or Customer Type.
- Each unique value becomes one row.
- Columns = the categories that become column headers.
- Example: Month, Year, or Status.
- Each unique value becomes one column.
- Values = the numeric columns you want to summarize.
- Example: Sales, Quantity, or Revenue.
- Aggregation = how to combine the values in each cell.
| Aggregation | What It Does |
|---|---|
| Sum | Add all values |
| Average | Mean of values |
| Count | Number of rows |
| Min / Max | Smallest or largest value |
| Median | Middle value |
| Std Dev | Standard deviation |
Example: Sales by Region and Month
- Rows: Region (North, South, East, West)
- Columns: Month (Jan, Feb, Mar, …)
- Values: Sales (numeric)
- Aggregation: Sum
---
Curve Fitting
What Is Curve Fitting?
Curve fitting finds a mathematical curve (line or function) that best describes the relationship between two (or more) variables. For example: Does sales increase linearly with advertising spend?
Types of Curves
#### Linear
- Equation: y = a + b·x
- Shape: Straight line
- When to use: Relationship looks roughly straight (e.g., sales vs. advertising)
#### Polynomial
- Equation: y = a + b·x + c·x² + …
- Shape: Curved (parabola, S-curve, etc.)
- When to use: Relationship curves (e.g., growth that slows over time)
#### Exponential
- Equation: y = a · e^(b·x)
- Shape: Rapid increase or decrease
- When to use: Growth or decay (e.g., population, virus spread)
#### Logarithmic
- Equation: y = a + b · log(x)
- Shape: Quick rise, then levels off
- When to use: Diminishing returns (e.g., learning curves)
R-Squared Interpretation
R-squared (R²) tells you how well the curve fits the data.
| R² Value | Meaning |
|---|---|
| 1.0 | Perfect fit—all points on the curve |
| 0.8 – 1.0 | Very good fit |
| 0.5 – 0.8 | Moderate fit |
| 0.2 – 0.5 | Weak fit |
| 0 – 0.2 | Poor fit—curve explains little of the variation |
| Negative | Fit worse than a horizontal line |
How to Use Curve Fitting
- Select variables: Choose X (predictor) and Y (outcome).
- Pick curve type: Linear, polynomial (degree 2, 3, …), exponential, logarithmic.
- Run fit: The tool computes the best coefficients.
- Interpret: Check R², coefficients, and plot the curve over your data.
- Predict (optional): Use the equation to estimate Y for new X values.
Quick Reference
| Task | Where to Go |
|---|---|
| Summarize by category | Pivot > Rows + Values |
| Cross-tabulate | Pivot > Rows + Columns + Values |
| Linear trend | Curve Fit > Linear |
| Curved trend | Curve Fit > Polynomial |
| Growth/decay | Curve Fit > Exponential |
| Diminishing returns | Curve Fit > Logarithmic |
What's Next?
- [Formula Builder](formula-builder-guide) – Calculated columns and expressions
- [Statistics Overview](statistics-overview) – Full statistics workflow
Related Articles
Statistics Overview: What Are Statistics and How to Use Them
A beginner-friendly introduction to statistics, descriptive vs inferential analysis, the Statistics workspace layout, and running your first analysis.
Formula Builder: Calculated Columns and Expressions
Build powerful calculated columns using column references, pipe chaining, and 70+ functions across String, Math, Date, Aggregation, Finance, and Geo categories.
Was this helpful?