Calculating and Filtering Percentage Discounts in Mergado#

How to Calculate and Filter Percentage Discounts in Mergado?#

This guide walks you through calculating the percentage discount between the original price and the sale price and shows how to filter products by discount level. You need a pair of elements in your feed – for example, in Google format:

  • original price: g:price
  • sale price: g:sale_price

From these values, you can easily calculate the discount percentage and use it for feed modifications, exports, or filtering (e.g., show only products with a discount > 10%) and plan campaigns accordingly.

Discount formula: ((original price - sale price) / original price) * 100

Step 1: Save the Discount to a New Element#

Want to have the discount directly in the feed as a custom element? Follow these steps:

  1. Create a new element Go to Elements → Add new element (the button is below the element list). Element name: DISCOUNT (or e.g., DISCOUNT_PERCENTAGE).

  2. Create a “Calculation” rule Open Rules → New rule → Calculation.

    • Rule name: “Calculate discount”.
    • Target element: DISCOUNT.
    • Calculation formula: ((%g:price% - %g:sale_price%) / %g:price%) * 100
    • Recommendation: set rounding to whole numbers.
  3. Save and apply the rules.

  4. Check the result (example)

    • g:price = 1000
    • g:sale_price = 750 → the DISCOUNT element will have a value of 25.

Step 2: Filter Products by Discount Without a New Element#

Need to quickly filter by discount? Use the calculation directly in a query (MQL) – no new element is needed.

Example query for discount > 10%: ([g:price] - [g:sale_price]) / [g:price] * 100 > 10

This query finds all products with a discount greater than 10%.

Tips#

  • Queries in Mergado can calculate. You can use mathematical operations directly in conditions – not just static values. This is useful for checking discounts or price-to-value ratios without creating additional elements.
  • Calculate margin the same way as discount. If you have purchase and selling prices in the feed, you can calculate the percentage margin: ((%g:price% - %PURCHASE_PRICE%) / %g:price%) * 100 Either create a new Calculation rule (e.g., into an element called MARGIN_PERCENTAGE), or use it directly in queries to filter products with a margin higher than a chosen percentage.

FAQ#

What is the correct formula for calculating a discount?#

((original price - sale price) / original price) * 100

Do I have to create a new element to filter by discount?#

No. Use the calculation directly in an MQL query, e.g.: ([g:price] - [g:sale_price]) / [g:price] * 100 > 10

Where do I create a new element for the discount?#

In Elements → Add new element. Recommended name: DISCOUNT (or DISCOUNT_PERCENTAGE).

How do I set up a rule for calculating the discount into an element?#

Rules → New rule → Calculation, name “Calculate discount”, target element DISCOUNT, formula: ((%g:price% - %g:sale_price%) / %g:price%) * 100. We recommend rounding to whole numbers.

Can I also calculate the percentage margin?#

Yes. Use: ((%g:price% - %PURCHASE_PRICE%) / %g:price%) * 100 Either as a new rule into an element (e.g., MARGIN_PERCENTAGE), or directly in queries.

Was this article helpful?