Skip to content

Tgt - Ranking stores and explaining end-of-month gaps

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.


A Zap that triggers on the 1st of each month and produces two things:

  1. A Slack summary message ranking each store by performance level for the past month
  2. Gap analysis threads for stores with extreme results — those that overperformed or failed — generated via the gap analysis sub-Zap

Performance levels are defined as follows:

LevelThresholdEmoji
Incredible≥ 140% of target🚀
Success100% to 140%🟢
Failure90% to 100%🟠
Disaster< 90%🔴

Schedule → Date calculation → Store query → Formatting → Slack → Loop (Filter → Sub-Zap)

Configure a Schedule by Zapier block:

  • Frequency: Every Month
  • Day: 1
  • Time: 9:00 AM

Biron queries require explicit dates. This block dynamically generates the boundaries of the previous month 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 previous month
- End of previous month
Output: return an "output" dictionary with all dates in YYYY-MM-DD format.

Create a per-store chart in Biron retrieving the target achievement rate for the previous month. Copy the NexusQL, paste it into the Biron Query block and replace the static dates with the variables produced in the previous step.

Then add the following calculated column directly in the query to categorize each store:

CASE
WHEN `% Atteint Objectif CA HT` < 0.90 THEN 'Catastrophe'
WHEN `% Atteint Objectif CA HT` < 1 THEN 'Echec'
WHEN `% Atteint Objectif CA HT` < 1.40 THEN 'Réussite'
ELSE 'Incroyable'
END AS result_tier

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: Generate a Slack summary message of store performance
against their targets for the previous month.
Available inputs (via input_data):
- stores: store names (comma-separated list)
- targets: target achievement rate in % (comma-separated list)
- tiers: performance category (comma-separated list)
Request:
1. Automatically calculate the name of the previous month and the year.
2. Group stores by category in this order, with the associated emoji:
🚀 Incredible | 🟢 Success | 🟠 Failure | 🔴 Disaster
Unknown categories go into a ⚪ Others group displayed last,
with the original category in parentheses.
3. For each store, display: ▪️ Store name: 97%
4. Generate a Slack message slack_message with:
- Bold title: *📊 Store Target Summary - {Month} {Year}*
- Store groups with category names in uppercase
- Empty categories are not displayed
5. Return the result in output with the key slack_message.

Add a Slack block and configure:

  • Channel: the channel where the summary should be sent
  • Message Text: the slack_message variable produced by the formatting block

Add a Looping by Zapier block, passing it the store names and their result_tier from the query.

The loop iterates over each store and executes the following two steps for each of them.


Add a Filter block with the following condition:

  • Continue only if result_tier is among: Incroyable, Echec, Catastrophe

Stores in Réussite are stopped here — their result is on track and does not require deeper analysis.


For each store that passes the filter, trigger the gap analysis sub-Zap by passing the four expected variables:

VariableValue to pass
start_dateStart of previous month (date calculation step)
end_dateEnd of previous month (date calculation step)
shop_idStore name or identifier (current loop iteration)
slack_tsTS of the Slack message sent in the previous step

On the 1st of each month at 9 AM, your team receives a Slack summary of the past month. Stores with extreme results — either overperforming or struggling — automatically receive a gap analysis in thread, explaining the causes of the result and potential action levers.