adding calculated columns

david763

New Member
Joined
Apr 3, 2012
Messages
42
Office Version
  1. 365
Platform
  1. Windows
hi, still a bit new to excel power query editor.. I am looking to add a couple of calculated columns to a connected table.. (imported from another workbook)

the main table 'risk_data' contains rows of risk data including likelihood and consequence for each risk.

I have another table "tbl_matrix" in the workbook on sheet 'matrix' (below) which has risk levels and scores for each combination.

I want to create two columns in risk data table in power query editor, both based on the likelihood and consequence for each risk..

eg if a risk in the risk table has a L of 'possible' and C of 'moderate', i want a column to pull through the associated "Medium" value from the matrix and another column to similarly pull through the corresponding score value of '9'.

not sure if i can do a "lookup" in the column formula or if i need a bridging connection only query...?

i'd be grateful for any ideas?

matrix table:
LikelihoodConseqLevelScore
RareInsignificantLow
1​
UnlikelyInsignificantLow
2​
PossibleInsignificantLow
3​
LikelyInsignificantMedium
4​
Almost CertainInsignificantMedium
5​
RareMinorLow
2​
UnlikelyMinorLow
4​
PossibleMinorMedium
6​
LikelyMinorMedium
8​
Almost CertainMinorHigh
10​
RareModerateLow
3​
UnlikelyModerateMedium
6​
PossibleModerateMedium
9​
LikelyModerateHigh
12​
Almost CertainModerateVery High
15​
RareMajorMedium
4​
UnlikelyMajorMedium
8​
PossibleMajorHigh
12​
LikelyMajorVery High
16​
Almost CertainMajorExtreme
20​
RareCatastrophicMedium
5​
UnlikelyCatastrophicHigh
10​
PossibleCatastrophicVery High
15​
LikelyCatastrophicExtreme
20​
Almost CertainCatastrophicExtreme
25​
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
All you will need to do is Merge Queries. From your risk_data query, click on Merge Queries, while holding the CTRL key select both Likelihood and Conseq from the top half
Then on the lower half, select the tbl_matrix in the drop down. When the preview appears, also CTRL and select Likelihood and Conseq on the bottom half. Click OK.

It will then merge. When the new column appears, expand it and then select both the Level and Score.
 
Upvote 0
Thank you @johnny51981.
That part worked fine. A couple of other questions.
  1. Where there is no match (approx 10 records from 250 are "not assessed") is there another way of handling the gap other than "null"? I think that adding a row to handle in the matrix itself might solve this (possibly answered my own question there :unsure:)
  2. More significantly... in the risk table there are several other fields with the likelihood and consequence rating (ie one rating for 'current' risk and one for 'future' risk). I need to apply the same process to both types of risk. that is, each record in 'risk table' will have two risk ratings and two risk scores. from what i can tell, only two tables can be utilised with the merge function...?
Thanks again for your help...
 
Upvote 0
1. Yeah, the nulls are just stating that the combination that is in your risk_data isn't listed in the tbl_matrix, and therefore would need to be added to the tbl_matrix.
2. You would follow the same Merge Queries steps again, only this time selecting the Likelihood and Consequence columns for the future from the risk_data
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,212
Members
452,618
Latest member
Tam84

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top