
Parameter Tables in Power BI / Power Query
A few years ago, before the ‘Manage Parameters’ was even invented / created by the Power Query / Power BI team, there was only a way to create a pseudo Parameter actually coming from an Excel Table.
The first person to ever write about it was my friend and legend Ken Puls and you can read his blog post about it here.
Ken Puls wrote that post in 2014 as it’s still relevant to this day. It’s such a profound an impactful contribution to the Power Query ‘game’ that we ended up adding this to the ‘M is for Data Monkey’ book that we co-authored.
See, Ken is what you can call a Legend. He’s been an Excel MVP for many many years, even before I turned 18 years old and this guy has some wisdom on many areas from Excel, VBA, DAX, BI and more skills (check his Legend Card above).
From his wisdom, he was able to come up with an Excel formula that has completely changed the game for anyone using Power Query inside of Excel which is: =LEFT(CELL("filename",B6),FIND("[",CELL("filename",B6),1)-1) and that Excel formula will give you the current file path of your file which you can later use to create references to where exactly other files might be from your solution. Again, just go ahead and read the full blog post from Ken about it – it’s a really good read. In his blog post he talks about a specific way to create a Parameter table. In this blog post we’ll take a deep dive into how you can create Parameter tables and take your Parameter skills to a whole new level.Possible Layouts for a parameter table
The first topic that we need to tackle is, how does a Parameter table look like? They have 2 distinct layouts:- Record-like Table – this is the one that Ken used in his example and here’s a quick example of one:
- Parameters as Table Headers – instead of relying on just one value for a parameter, we can have multiple values that we can use for a single output. Here’s an example of how you could use that one:
Referencing Values from a Parameter Table
In his blog post, Ken provided an easy to use custom function and explained how to use it so you can extract the values from a Parameter table sourced from an Excel workbook. Since we want to go beyond that, and give you the concepts behind it so you can create your own, I’m going to reference a full blown blog post that I created a few months ago about how to Navigate through rows, columns and cells inside of Power Query / Power BI. Click in the image below to go to that blog post:(click on the image above to check the full blog post on Custom Functions)



Comments