Fast-Food chart from the Economist

On the topic of McDonald’s slowly going downhill, the Economist came up with a decent little chart on fast-food around the world.

See it yourself on the Economist’s site; below are some of my thoughts on the matter.

1. There are a lot of restaurants in the States compared to the rest of the world.

Fast-food outlets per person in each country

You can check the interactive map over at the Economists – it’s 224 restaurants per million people in the US. Think of demand-supply. There are a lot of restaurants in the States because there is a high demand for fast-food.

See that, young padawan? Only in the Us and Canada are there more than 200 restaurants for each 1 million citizens. Australia and Iceland also fall towards the end of the spectrum, however, let us not forget that the population of Iceland errs around 400 thousand people, Australia’s at 23 million. Both Iceland and Australia have a population density of 3 people per every square mile. (One day I will write up an article just on population density and urban development.) (US pop.density  34; population is at 320 million.) Less customers to serve by the same ratio of restaurants.

2. Canada has just as much.

The total number of Mcdonalds restaurants

Checking the number of restaurants between Canada and the US, we can see that Canadians have 1/10th of the number of McDonalds. Does Canada have less citizens, too? Yes. 35 million vs. US’s 320 million. Tenth of the restaurants for tenth of the citizens, numbers decrease proportionally.

However, an important point, that probably relates to #1 and #2, is that this map is very America-centric. I’d presume there is a good chance of the States and Canada having the most amount of Mcdonald’s / KFC / Starbucks / Subway / Pizza Hut for these chains are American. Whereas in other countries the local chains are not being considered in this map.

3. Subway takes it all.

Leading_chains_per_country

Look who has the most restaurants in the most countries! Yes! Subway takes it all. What I love about this last chart is Greece and South Korea: they both have more Starbucks than other restaurants. In fact, Greece has 31 Starbucks and 43 everything-else; and South Korea has 700 Starbucks and 960 everything-else. (Everything-else being KFC, Pizza Hut, Subway, and McDonald’s.) Them Greek and South Koreans really love overpriced, mediocre coffee.

Conclusion: this is a good map, but it’s very America-centered. There is a good chance that local chains, that aren’t represented on the map, have a strong presence in countries, which would definitely give a biased representation of # of fast-food restaurants per population on this map, as we could see in the points above.

Now run along, and click around in this sweet little chart on the Economist’s site. By the way – it was made with Raphael.js. A UX job well done, Economist’s data team!

 

 

Running sum for last 12 months, SQL style

I’m going to tell you a little secret. Come, sit closer.

You know your running chart for every other dashboard, showing

the SUM / Average / Top / Least / etc.

of Sales / New customers / Quotes  / etc.

for the last…

1 hour / 1 day / 1 week / 4 weeks / 12 months / etc…. ?

In SQL world I’ve been solving the problem with dateadd() getdate().

SELECT
sum(case when month(orderDate) = dateadd( mm, -1, getdate()) then orderAmount end) as [total order amount last month]
FROM
GoatOrders
GROUP BY
month(orderDate)

Of course if you want your chart to contain the last 12 months, you’d have to repeat the select 12 times. No brainer, redundant query.

Here comes this little trick I’ve been using:

SELECT
SUM(orderAmount), month(orderDate)
FROM
GoatOrders
WHERE
orderDate >= dateadd(yy, -1, getdate())
GROUP BY
month(orderDate),
year(orderDate)
ORDER BY –this is where the magic happens
year(orderDate) desc,
month(orderDate) desc

The ORDER BY has it all.

On a completely unrelated note: USA won 2-1 against Ghana!

Conclusion: Now you know how to write even shorter code for your running charts.

Sounds like Ukraine needs some freedom

The Washington Post published an interesting visualization. They asked people two questions:

  1. Where is Ukraine on the map?
  2. What should the US do with this Ukraine-issue?

The answers to the first question are summarized in the following map.

16% of the respondents correctly placed Ukraine on the map, the median response was within 1800 mile radius.

In general, younger Americans tended to provide more accurate responses than their older counterparts: 27 percent of 18-24 year olds correctly identified Ukraine, compared with 14 percent of 65+ year-olds. Men tended to do better than women, with 20 percent of men correctly identifying Ukraine and 13 percent  of women. Interestingly, members of military households were no more likely to correctly locate Ukraine (16.1 percent  correct) than members of non-military households (16 percent  correct), but self-identified independents (29 percent  correct) outperformed both Democrats (14 percent  correct) and Republicans (15 percent  correct).

Here comes the fun part: the correlation between the first and the second question.

However, the further our respondents thought that Ukraine was from its actual location, the more they wanted the U.S. to intervene militarily.

I would like to ask: what are those 5 dots doing on US soil, 20 dots if you include Alaska as well? Same applies to Australia – I mean, come on, it’s kind of hard to miss where Australia is, so clearly that can’t be Ukraine. What about those dots in the ocean?

What about the million dots in Russia? If Ukraine were part of Russia, we wouldn’t be talking about this conflict right now.

Conclusion: Before you voice your opinion, make sure you have a good understanding of the circumstances, geographical locations included.