Reducing Supermarket Food Waste with Dynamic Pricing

dynamic pricing

The ability to react and cater to consumer demand is nearly always a competitive advantage, but it also comes at a price. Naturally, when a shopper heads to the store to buy their groceries, they expect everything on their list to be available, and their products fresh.

But as supermarkets manage a growing number of products with varying expiration dates, they’re faced with the increasing challenges of selling these items before they expire while making sure they generate as much profit as possible. Failing to accomplish this not only hurts the retailer’s bottom line but also leads to unnecessary food waste. In fact, one-third of the food produced for consumption is lost or wasted globally, and grocers are significant contributors.

In order to save sales and limit loses, grocers often incentivize shoppers to make purchases by discounting products nearing their sell-by date. However, the challenge is that they often struggle to find the perfect pricing and timing balance that will maximize sales and also minimize the discount they need to offer. They walk a thin line of discounting too early or offering discounts that are too high.

With hundreds of thousands of SKUs, internal teams simply can’t manage the complexity of this process. Fortunately, the emergence of AI-enabled solutions makes a responsive price strategy on perishable food far more simpler and more profitable.

Let’s explore how artificial intelligence allows grocery retailers to bypass old roadblocks by enabling dynamic pricing strategies that pad margins and reduce food waste.

Traditional limitations to pricing

Historically, responsive price adjustments were a hassle, or even impossible, especially in physical stores. The process relied on rules-based algorithms that required significant manual oversight.

Picture the pricing gun – employees have to manually walk through the store and change the price on each individual product if there is a sale or special offer on these items. For supermarket and food retailers, the selling period for marked down products is very short, creating a major pain point when attempting to optimize prices in real-time.

These obstacles have led to the development of new tools that automate efforts around identifying optimal prices and enable retailers to make the resulting adjustments quickly.

Optimizing price around sell-by dates

Today, the use of artificial intelligence has led to breakthroughs in markdown pricing. Aggregating demand behavior (historical and current) with inventory information, competitor pricing and sell-by dates allows for pricing strategies that can be optimized in real-time, across all areas of business, and at scale.

For example, bananas that begin to ripen need to be sold while consumers are still willing to pay for them, but not before a new shipment comes in. Providing discounts to shoppers on products that are still fresh gives shoppers an incentive to buy now. This can even be done on a granular, individual store level, as inventory and consumer buying patterns vary based on store geographies. What this means for customers is that products are available at any time at the best possible price, ultimately leading to less wasted food.

Increasing profitability through product affinity

Retailers can also increase profitability by optimizing pricing on products with strong affinity. Analyzing data on products that are sold together, retailers can detect cross-sell opportunities and markdown one product while driving sales of other related products at full price.

As shoppers head to the grocery store for the fourth of July, retailers can find areas to increase sales with perishable and non-perishable items typically paired together. For example, offering a markdown on cherries nearing their sell-by date, if bought with a pie crust, or similarly, full-priced hotdogs and discounted buns.

By linking multiple items, retailers can lower prices of certain products that may have otherwise expired while still increasing the bottom line by ensuring sales of higher-margin items.

Empowering retailers to reduce food waste and better serve shoppers.

When a business deploys dynamic pricing, they become more sustainable – both environmentally and financially. But it also has the benefit of generating loyalty among shoppers who receive the best deals and competitive prices. In addition to time-sensitive food, retailers can also see the advantages of markdown pricing for seasonal items or products with short selling cycles.

With dynamic pricing driven by AI, retailers can gain a holistic view of their entire inventory in real-time, as well as the connections between products, and can optimize their strategies on the fly in order to reduce food waste and better serve shoppers.

allonline365 specializes in retail solutions to help manage your business. We offer solutions that address your current business needs as well as your future ones. Choose a solution that digitizes your business and grows along with you. Contact us on or  +27 (21) 205 3650.

Resource Credit | Progressive Grocer 

Import Email Attachments Directly Into a Power BI Report using Power Query

Power Query has more than 80 data sources supported, and Microsoft Exchange is one of those data sources. Although it is not a new data source, however, the power of this data source combined with the data transformation power of Power Query is not clear for everyone. Using this data source, you can get all emails in your inbox (or other folders), and then filter is based on sender or subject, and then expand attachments of emails into a table and visualize it at the end in Power BI. You can do all of that using Power Query in Power BI, you won’t need to do any manual step of saving attachments into a shared folder, and then get data from that folder. In this article, I’m going to show you how it is possible.

Get Data from Email

Mailbox is a data source that can be very beneficial. There are a lot of important data coming through emails. sometimes with attachments, sometimes without. A mailbox also can have other parts such as calendar, tasks, and people which can be very helpful for a data insight solution. In Power BI, or let’s say using Power Query, you can start getting data from your mailbox, using the Get Data option from Microsoft Exchange;

Then you need to enter your email address;

and after that, you will be asked to enter credentials. If you have Office 365 mailbox, then you can use Microsoft tab to login. After successful login, you will see a list of all entities that you can get data from that;

As you can see in the above screenshot, I can get Calendar items, Mails, Meeting requests, People and Tasks from a mailbox. The screenshot above shows an example of a Calendar entity. However, in this example, I’m focusing on Mails. So I choose that to get data from and then click Edit to filter my data before loading it into Power BI;

This will bring up the Power Query Editor with a preview of emails I have in my inbox;

This would be a table including all email properties as well as a couple of fields for HasAttachments and Attachments itself!

Filtering Data

In this example, I’m focusing only on emails with specific attachments. You have to find the rules to filter the table based on it. For example, if you are going to filter based on the sender, then you can expand the Sender field (which is a record itself), and then filter based on the email of the sender;

Or if you want to filter based on the subject, then you can do the filtering based on that;

Filtering the Folder

You might also want to filter based on the folder in your email account (in case you have emails coming or going from multiple folders), These are folders in my inbox for example; which from that list I select Inbox only.

Filtering the Subject

In this example, I’m expecting emails to come with the subject line of “sample files for email PQ test”, so I filter it this way;

And I put the subject line I’m expecting there;

As a result, I only have emails with that subject line in that specific folder;

Expanding Attachments

If you scroll further right in the columns list in the table above, you will see two columns for attachments; HasAttachment, and Attachments. HasAttachments will have values of TRUE or FALSE saying that this email has attachments or not (which can be also a good filter added to the previous step too, to make sure you only get emails that have an attachment). If you click on the Attachments itself, you will see a table which has all the details about attachments;

Let me show you where this is coming from, this is one of the emails above in my mailbox; (you can see that there is an attachment for it as well, with exactly the same size, name, and extension)

We are only interested in the content of attachments, so let’s expand to this folder, however, first it is better to remove all other columns as we don’t need them anymore;

Then you can expand the Attachments using the expand icon;

You will have now a table of all attachments coming from all emails that we have filtered before;

There are columns such as Name of the attachment file, Extension of it, the size and some other properties. Most importantly, we have the AttachmentContent column, which includes the file itself in the binary format. And that is the column, which we are going to focus on. So let’s remove all other columns.

Combine Files

Now that we have all files in a table column, we can combine them using the Combine Files option.

Power Query, will scan the files, and consider the first one as a template structure for others (remember for this method your files should have the same structure, otherwise you need to create multiple copies of this process into multiple tables using different sets of filters). My files are CSV files, Power Query understand the structure and comes up with a preview of the default structure;

This process will create a custom function behind the scene from one of the files and will loop through it for all files, as the result, I will have a table including the content of all files together;

The dataset in my example needs some cleanup, and it would look like this afterward;

Here you go! You have expanded all attachments directly into Power BI without needing any manual download and save in a shared folder. All through Power BI and Power Query! Before you start implementing it in a real-world scenario, here is an important tip to remember!

Make it Failproof

Building a solution is one thing, and making it failproof is another. There are tons of reasons why a solution might fail somewhere in the future. for example, consider that the next email comes like this:

The email above has some CSV files which are fine, However, it has some other attachments too. For example, the image in the signature! when I refresh the model that I built so far in Power Query, I get this:

In this case, I know the reason is because of the image attachments, and I can go to the Expanded Attachments step in Power Query to find that out;

I can filter the Extension filed to .csv only to make sure I won’t get other types of attachments;

This way, the solution would work fine with no errors.


Power Query can get data from Exchange, which helps you to automate the process of importing attachment’s data directly into Power BI or Excel. You can then use the transformative power of Power Query for filter based on all necessary fields, and expand attachments into a structured table. This method will be a fully automated solution, and the next time that you receive an email with attachments, it will bring them into the output too. However, make sure to build a failproof solution always. This method would also work with shared mailboxes, as long as there is an actual mailbox associated with it.

Learn more about Power BI and its capabilities. Let allonline365 help you make the right software choices for your business. Call +27 (21) 205 3650 or email us on

Resource Credit | RADACAD

allonline365 Newsletter

Call Now Button