If you catch yourself copying the same CASE WHEN or date-trick into five queries, it is time to turn it into a Function. EQQ functions are named, reusable SQL snippets that any query designer can drop into a query.
The fQQ_ convention
By convention, EQQ-managed functions are prefixed with fQQ_ (e.g. fQQ_MonthBucket, fQQ_CurrencyRound2). This keeps them discoverable and prevents collisions with database-native functions.

Create your first function
- Open Manage Functions → New.
- Name it
fQQ_MonthBucket. - Pick a Category (e.g. Date / Time).
- Paste the SQL body:
DATEFROMPARTS(YEAR(@d), MONTH(@d), 1). - Declare the parameter
@das date. - Save. The function is now available in the query editor.
Call it from a query
SELECT fQQ_MonthBucket(OrderDate) AS Month, SUM(Amount) AS Revenue
FROM Orders
WHERE OrderDate BETWEEN @StartDate AND @EndDate
GROUP BY fQQ_MonthBucket(OrderDate)
ORDER BY Month
Why this scales
- One place to fix a bug - fix the function, every query is fixed.
- One place to update business logic - change the definition of “revenue” in one function.
- Analysts read a query with
fQQ_MonthBucketand instantly know what it does.
Want to see it live? Book a 30-minute demo - we connect EQQ to your database and build a query with you. Book a Demo →