Please note javascript is required for full website functionality.

Blog

Power Query: Riveting Results Part 9

9 February 2022

Welcome to our Power Query blog. This week, I create parameters from another Excel file.

My salespeople are retraining. This week, I continue looking at the exam results I created in Power Query: Riveting Results Part 1:

I will be grading the results, and I will be using this example to explore parameters. Last week, I created a query as a building block for parameters extracted from another workbook, which I called ‘Base Query’.

I also created a FilePath parameter to store the location of the other workbook:

Having created the FilePath parameter, I return Base Query.  For me, the M code for the Source step is:

= Excel.Workbook(File.Contents("C:\Users\kathr\OneDrive\Documents\SUMPRODUCT\PQ Blog\Blog 270 Exam Grade Bands.xlsm"), null, true)

I am going to replace the path with the FilePath parameter:

= Excel.Workbook(File.Contents(FilePath), null, true)

This is easier to read, and now I can change the path by changing the FilePath parameter.

I can now select Base Query in the Queries panel and right-click to create reference queries which will become the new grade band Parameters:

I rename the first new query EDP_Grade_9. The Source step points to Base Query. I can click on the ‘Table’ text next to Grade_9 to expand the data for that row:

This gives me the data for Grade_9 from the workbook, and I can right-click and drill down to the value:

This gives me the first parameter:

I can then make more references of Base Query and repeat this process to get the other ‘EDP_Grade_’ parameters.

Next time, I will go back to the Exam Results query and use these parameters.

Come back next time for more ways to use Power Query!

Newsletter