SOLVED

Calculate CO2 in Excel and PowerBI

Copper Contributor

Hi

 

In my role in local government I work with businesses and developers to encourage sustainable travel. Within this I help with the delivery of travel surveys which are used to monitor changes in the modes of transport that are being used.

 

I have traditionally used Excel for analysis and reporting but I am now starting to make use of PowerBI for this.

 

I am wondering if there is a way in Excel and PowerBI to calculate CO2 emissions for a journey where some of the elements in the calculation would be determined by the mode of transport used.

 

I have a table with details of journeys broken down into stages to allow for people making use of different transport modes in the course of their journey: 

Mode 1Time 1Destination 1Other 1Mode 2Time 2Destination 2Mode 3Time 3Mode 4Time 4Destination 4
Drive a car alone25My place of work         
Drive a car alone45My place of work         
Cycle45My place of work         
Cycle60My place of work         
Taxi15My place of work         
Car share as a driver15My place of work         
Car share as a passenger10My place of work         
Taxi25My place of work         
Car share as a driver30My place of work         
Motorcycle (above 125cc)20My place of work         
Car share as a passenger20My place of work         
Motorcycle (above 125cc)15My place of work         
Walk5The bus stop Bus25The bus stop  Walk5My place of work
Walk15My place of work         
Walk20The bus stop Bus10My place of work     
Walk15The bus stop Bus35The bus stop  Walk15My place of work
Walk5The bus stop Bus25The bus stop 0Walk10My place of work

 

I also have a table which contains the information on average speeds and the average CO2 emissions per km:

Mode Average Speeds, expressed as kilometres per hour:  CO2 Factors. These are expressed as kilogrammes of CO2 per passenger per kilometre:
Walk4.80  Underground0.065
Cycle20.0  DLR0.075
Underground33.0  Tram0.042
DLR25.0  Commuter Train0.062
Tram22.7  Bus0.081
Commuter Train40.0  Drive a car alone0.206
Bus15.5  Taxi0.168
Drive a car alone26.5  Scooter0.073
Taxi26.5  Motorcycle (above 125cc)0.112
Scooter26.5  Riverboat unknown
Motorcycle (above 125cc)26.5  Car share as a driver0.129
Riverboat19.0  Car share as a passenger0.129
Car share as a driver26.5  Motorcycle (below 125cc)0.112
Car share as a passenger26.5    
Motorcycle (below 125cc)26.5    
Park and Ride15.5    

 

The CO2 is calculated by:

1. Multiplying the time taken by the average speed for the mode used (e.g. 25*26.5) and divide by 60 (to allow for conversion from minutes to hours) to give distance travelled (expressed in kilometres).

2. multiply the distance travelled by the corresponding “CO2 Factor”. This will give kilogrammes of CO2 for each mode travelled.

 

What I would like to be able to do is automatically calculate the relevant CO2 amount for each row where the average speed and the CO2 Factor will change depending on the mode of transport used.

 

Does anyone know if it is possible to run a calculation like this in Excel or PowerBI and if so how it would need to be written to take into account the different multipliers to be used?

 

Many thanks in advance,

Andy

8 Replies
Hi,
can you attach an example spreadsheet?
easy, send the column headers in the rawest form (however it's exported from). If that's the pick list, shouldn't be too hard. I work with surveys so I can automate this type easily. Neat project, what generally are you looking to find or how are you trying to visualize?

Hi @StoneKiwi 

 

I have attached the spreadsheet that I have been working with.

 

Any help you can provide will be most helpful.

 

Andy

@Cheugy 

 

Hi

Thanks for the reply.

What I would like to be able to show is the amount of CO2 produced by each mode of transport that produces this.

So for instance if it is possible to do so car should show the amount of CO2 as a combination of Drive a car alone, Car share as driver and Car share as passenger.

As this is for reporting survey outcomes a simple bar chart would suffice.

I have attached the spreadsheet that I have been working with.

 

@thomsona1969

Thanks for sending! Would you also have the raw output of the survey results? I'd like to automate this for you so you can just paste the data and things will calculate automatically.

@Cheugy 

I hadn't got as far as anything to output the results in other than with a Pivot table and chart as in the attached. I had moved on to using PowerBI for this but need to have the ability to do this in Excel as a fall back especially if someone else takes on this work

best response confirmed by allyreckerman (Microsoft)
Solution

@thomsona1969 

 

Hi there,

 

So I took a stab at it and looked like you were doing a lot of manual things to get the calculations going. First thing I did is change up the formulas in column E,I, L, & P. I put in an index/match formula that will crawl through the "Factors" sheet to find the respective CO2 emissions (factors 1 & 2). With different data entries, you'll need to update these values for the fields in the raw data to compute properly. Secondly, because there are mulitple methods of transportation that vary from 1 - 4 selections, I added in a column (R) to find the main method of transportation (I used the max time of commute among the values in the row). Column R will spit back the main method of transportation. And lastly (regarding the column changes), added in 1s for column T to count the unique survey participants. 

 

I formatted everything as a table, so the pivot will reference the table instead of a range (this will help you avoid having to update the pivot range each time an entry is made).

 

If you enter in new data, just click the refresh button on the data tab.

 

I would recommend that you finalize the survey and export in the rawest form and then build formulas around on new columns on the right. That will make it much easier if you anticipate thousands of incoming surveys.

 

The pivot chart will show the total CO2 emission by individuals (using their primary form of transportation) along with the count of survey takers. You could also show averages, but in this case, I think sheer volume might be the way to go. Secondary axis will show the count of unique survey takers.

 

Try keying in data and then hitting refresh to make sure things don't break. The "Factors" sheet will be your source of truth so anything missing will throw off the calculations (i.e., adding in a new type of transportation without updating the "factors" sheet will break the formulas)

 

Hopefully this helps, let me know if you have any questions.

 

Hi
Thanks for having a look at this and for coming up with a solution.
I will test it out and if there is anything that I am unsure of I will let you know.
Many thanks for the help,
Andy
1 best response

Accepted Solutions
best response confirmed by allyreckerman (Microsoft)
Solution

@thomsona1969 

 

Hi there,

 

So I took a stab at it and looked like you were doing a lot of manual things to get the calculations going. First thing I did is change up the formulas in column E,I, L, & P. I put in an index/match formula that will crawl through the "Factors" sheet to find the respective CO2 emissions (factors 1 & 2). With different data entries, you'll need to update these values for the fields in the raw data to compute properly. Secondly, because there are mulitple methods of transportation that vary from 1 - 4 selections, I added in a column (R) to find the main method of transportation (I used the max time of commute among the values in the row). Column R will spit back the main method of transportation. And lastly (regarding the column changes), added in 1s for column T to count the unique survey participants. 

 

I formatted everything as a table, so the pivot will reference the table instead of a range (this will help you avoid having to update the pivot range each time an entry is made).

 

If you enter in new data, just click the refresh button on the data tab.

 

I would recommend that you finalize the survey and export in the rawest form and then build formulas around on new columns on the right. That will make it much easier if you anticipate thousands of incoming surveys.

 

The pivot chart will show the total CO2 emission by individuals (using their primary form of transportation) along with the count of survey takers. You could also show averages, but in this case, I think sheer volume might be the way to go. Secondary axis will show the count of unique survey takers.

 

Try keying in data and then hitting refresh to make sure things don't break. The "Factors" sheet will be your source of truth so anything missing will throw off the calculations (i.e., adding in a new type of transportation without updating the "factors" sheet will break the formulas)

 

Hopefully this helps, let me know if you have any questions.

 

View solution in original post