Calculations for common jobs
Ready-to-paste formulas for order size buckets, customer lifetime value, shipping times, fiscal quarters, weekdays, name cleanup and net sales.
These are the calculations teams build most often, each with the formula, what it gives you and a real preview. Paste one into the Formula box, swap in your own field names, and check it against your rows.

When to use it
- A weekly sales review that splits revenue by order size and by customer value.
- An operations dashboard that tracks shipping speed in business days and flags late orders.
- A finance report that rolls up by fiscal quarter instead of calendar quarter.
- A cleanup pass on a messy export before anyone builds a chart from it.
Every recipe below came from the Superstore sample dataset. Your field names will differ; the [ suggestions in the editor fill them in.
Sales
Order size buckets
Group orders into Large, Medium and Small so you can color or filter a chart by size.
IF([Sales] >= 500, "Large", IF([Sales] >= 100, "Medium", "Small"))Put the biggest threshold first. IF stops at the first condition that holds, so a $2,573 order is Large and never reaches the Medium test.
Net sales after discount
[Sales] * (1 - [Discount])
Set Display format to Currency so it reads as money everywhere.
Profit margin
SAFE_DIVIDE(SUM([Profit]), SUM([Sales]))Set the format to Percentage. SAFE_DIVIDE gives a blank instead of an error when sales are 0. Because it adds up first, each bar on a chart shows its true margin.
Customers
Customer lifetime sales
Every order row gets its customer's total sales, so you can bucket customers by value or filter to your top accounts.
FOREACH([Customer ID], SUM([Sales]))
Wrap it in IF to label customers: IF(FOREACH([Customer ID], SUM([Sales])) >= 5000, "Key account", "Standard"). A field built on FOREACH can go on Rows, Columns or Color like any category.
First name
SPLIT([Customer Name], " ", 1)
Use 2 for the second word. SPLIT isn't available on every data source; on an uploaded file it always works.
Operations
Business days to ship
BUSINESSDAYS([Order Date], [Ship Date])
Weekends don't count, so an order placed Friday and shipped Monday took 1 business day. For calendar days, use DATEDIFF("day", [Order Date], [Ship Date]).
Late or on time
IF(DATEDIFF("day", [Order Date], [Ship Date]) > 4, "Late", "On time")Change the 4 to your service level. Click a row, then Explain calc, to see which dates produced the label.
Days since last order
DATEDIFF("day", MAX([Order Date]), TODAY())On a table by customer, it shows how many days ago each customer last ordered. TODAY() moves every day, so the number stays current.
Dates and calendars
Fiscal quarter label
CONCAT("FY", STR(DATEPART("fiscalyear", [Order Date])), " Q", STR(DATEPART("fiscalquarter", [Order Date])))
The fiscal year follows your account's fiscal year start. STR turns the numbers into text so CONCAT can join them.
Day of the week
DAYNAME([Order Date])
Put it on an axis to see which days are busiest. Use DATEPART("weekday", [Order Date]) when you want a number to sort by.
Start of the month
DATETRUNC("month", [Signup Date])Every date in a month becomes the 1st, which makes a clean cohort field for "customers who signed up in March."
Cleanup
| Job | Formula |
|---|---|
| Trim stray spaces | TRIM([Name]) |
| Make codes match | UPPER([Product Code]) |
| Fill blank discounts with 0 | COALESCE([Discount], 0) |
| Treat "Unknown" as blank | NULLIF([Status], "Unknown") |
| City and state in one label | CONCAT([City], ", ", [State]) |
| First 3 digits of a ZIP code | LEFT([Postal Code], 3) |
| Read text like 03/15/2025 as a date | DATE([Order Text], "MM/DD/YYYY") |
Do it from chat
Describe the job and let the analyst write the formula:
Add a field that labels orders Large over $500, Medium over $100, and Small otherwiseAdd a field for each customer's lifetime salesAdd a fiscal quarter field like FY2025 Q3FAQ
Can I use one of these inside another calculated field? Yes. Once saved, a calculated field shows up in the Fields list and in the [ suggestions like any other field.
Why does my margin look different on a chart than in the preview? A formula with SUM gives one value per group. The preview works it out over the sample; the chart works it out for each bar.
Where do I find all the functions? See Calculation function reference.