Cleaning Up Coffee Production Data Using Power Query

Quote of the Day

Courage doesn't always roar. Sometimes courage is a quiet voice at the end of the day saying, 'I will try again tomorrow.'

— Poet and artist Mary Anne Radmacher on courage.


Figure 1: Row of Coffee Plants in Kenya.

I recently volunteered to do some pro-bono data analysis and front-end web development for a very nice Kenyan woman who is trying to provide a US distribution channel for some coffee growers in her native Kenya. This post documents my work on tidying her coffee data.

The story of Kenya's coffee growers is similar to that of other commodity farmers. Kenya's warm climate and mountain terrain are ideal for coffee production and it currently supports ~150K coffee growers (link). However, the Kenyan coffee growers have been going through a cycle of low prices – a business cycle similar to what US milk producers are going through now.

Unfortunately, there are only a few alternatives for dealing with low prices:

  • Lower your cost of production
    Tough to do – most producers have already squeezed the inefficiencies out of their processes.
  • Change to a more profitable crop
    Tough to do – this generally requires new equipment, learning new skills, and developing new markets.
  • Find a higher margin coffee sector
    Tough to do – others are already fighting to keep these markets.
  • Cut out the middlemen and sell directly to the consumer
    This is a bit like opening a Farmer's Market. My Kenyan friend is trying this approach.

In this post, I am using Power Query to clean up some data from the International Coffee Organization (ICO) for use in generating some graphics. This is a good example to show my coffee-growing friends on how to process their data.


The ICO puts its data out in Excel workbooks that are not in tidy format. My cleanup role consists of:

    • removing blank rows
    • changing the table from wide-format (years in columns) to long-format (a single year column)
    • incorporate a continent column

Power Query will allow these folks to update the automatically update the data as the ICO puts out new releases.


There is only one file: Coffee.xlsx. You can download it from here. No VBA involved, just Power Query.

Simple Graphics

I generated a copy of Excel graphs to illustrate how to use the data. Do not send me hate mail about using pie charts. I used them here so I could compare my data results with some ICO charts.

Figure 2 shows that Ethiopia is the dominant coffee producer in East Africa.

Figure 2: Horn of Africa Coffee Growing Percentages.

Figure 3 shows that South America dominates coffee production.

Figure 3: 2017 World Coffee Growing Percentages By Continent.


This proved to be a nice illustration of the use of Power Query to clean up some coffee data.

Post Script

I just showed the data to my coffee-growing friends. They had no idea how simple it was to clean up the data and to augment that data with information on Kenya. We then had a long discussion on things they could add to their web site. It was great to see these folks feel empowered!

This entry was posted in Excel. Bookmark the permalink.

1 Response to Cleaning Up Coffee Production Data Using Power Query

  1. Fanquip says:

    This article is helpful, coffee production needs this


Leave a Reply

Your email address will not be published. Required fields are marked *