Tgt - Estimating target reachability at month start
This use case illustrates a concrete use of the Biron plugin in Zapier. If you are not yet familiar with how it works (authentication, query structure, variable management), please read the Biron × Zapier guide first before continuing.
What we’re building
Section titled “What we’re building”A Zap that triggers on the 1st of each month and sends a Slack estimate of revenue target achievability for each store.
The forecast combines two signals:
- Seasonality: revenue realized on the same month the previous year (Y-1)
- Recent momentum: the growth rate over the last 3 months vs Y-1
Projected revenue = Y-1 revenue (month) × (1 + 3-month growth)The gap between projected revenue and the target determines an achievability category, from At risk to Guaranteed.
Zap architecture
Section titled “Zap architecture”Schedule → Date calculation → Forecast query → Formatting → SlackTrigger — Schedule by Zapier
Section titled “Trigger — Schedule by Zapier”Configure a Schedule by Zapier block:
- Frequency: Every Month
- Day: 1
- Time: 9:00 AM
Date calculation
Section titled “Date calculation”Biron queries require explicit dates. This block generates them dynamically on each run.
Add a Code by Zapier block (Python). Use the following prompt to generate the code, then paste the result into the block:
Role: Python expert for Zapier.Goal: Create a relative date calculation script.
Calculate the following dates, handling calendar edge cases(leap years, end of month):- Start of current month and Y-1- End of current month and Y-1- Yesterday and yesterday Y-1- 3 months ago and 3 months ago Y-1
Output: return an "output" dictionary with all dates in YYYY-MM-DD format.Forecast query — stores
Section titled “Forecast query — stores”Create a table-type chart in Biron per store with the following three metrics, then copy the NexusQL and paste it into the Biron Query block. Replace the static dates with the variables produced in the previous step.
| Metric | Description |
|---|---|
| Revenue excl. VAT full month Y-1 | Seasonality reference base |
| Revenue excl. VAT (last 3 months) vs Y-1 | Recent growth signal |
| Revenue excl. VAT target current month | Target to evaluate |
Once the query is in place, add the following three calculated columns directly in the NexusQL:
-- Projected revenue: Y-1 seasonality adjusted by recent growthROUND( `CA HT (A-1) Mois` * (1 + `Croissance CA HT 3 derniers mois`), 2) AS `Objectif Prévisionnel CA HT`,
-- Gap between forecast and target (in %)ROUND( 100 * (`Objectif Prévisionnel CA HT` - `Objectif CA HT`) / `Objectif Prévisionnel CA HT`, 2) AS `Delta Pourcent Prévisionnel CA HT`,
-- Achievability categoryCASE WHEN `Delta Pourcent Prévisionnel CA HT` < -15 THEN 'Compromis' WHEN `Delta Pourcent Prévisionnel CA HT` < -5 THEN 'Ambitieux' WHEN `Delta Pourcent Prévisionnel CA HT` < 5 THEN 'Attendu' WHEN `Delta Pourcent Prévisionnel CA HT` < 15 THEN 'Confortable' ELSE 'Garanti'END AS `Prévision Objectif`The categories produced and their meaning:
| Category | Forecast vs target gap | Emoji |
|---|---|---|
| Guaranteed | > +15% | 🔵 |
| Comfortable | +5% to +15% | 🟢 |
| On track | -5% to +5% | 🟡 |
| Ambitious | -15% to -5% | 🟠 |
| At risk | < -15% | 🔴 |
Formatting
Section titled “Formatting”Biron data must be converted into a readable Slack message. Add a Code by Zapier block (Python) and use this prompt to generate the code:
Role: Python expert for Zapier.Goal: Format store data for a Slack monthly target tracking message.
Available inputs (via input_data):- shops: store names (comma-separated list)- labels: category of each store (comma-separated list)- billing_target: revenue target (comma-separated list)- billing_predicted: projected revenue (comma-separated list)
Request:1. Group stores by category in this order, with the associated emoji: 🔵 Guaranteed | 🟢 Comfortable | 🟡 On track | 🟠 Ambitious | 🔴 At risk Stores with an unknown category go into a ⚪ "Uncategorized" group displayed last.2. For each store, display: • *Store name*: _Target_ 12 345,00€ | _Projected_ 11 200,00€ (thousands separator, 2 decimal places)3. Generate a Slack message slack_message_formatted with: - Bold title: *Monthly Target Forecast {Month} {Year}* - Italic subtitle: "Projected revenue is calculated from the previous year's performance (Y-1) adjusted by the last 3 months' growth." - Store groups (empty categories not displayed)4. Return the result in output with the key slack_message_formatted.Send — Slack
Section titled “Send — Slack”Add a Slack block and configure:
- Channel: the channel where the forecasts should be sent
- Message Text: the
slack_message_formattedvariable produced by the formatting block
Expected result
Section titled “Expected result”On the 1st of each month at 9 AM, your team receives a structured Slack message ranking each store from At risk to Guaranteed based on the estimated achievability of its monthly target — to orient priorities right from the start of the month.