Skip to main content

Field Parameters in Power BI

Have you worked with field parameters? Another functionality that Power BI offers is to improve your reports. What does it do for the users? At first, it looks like a button but it helps to toggle between different fields (can be columns or measures). Let's get our hands dirty and start with an example.

I am using sample superstore data. The idea is to make a clustered bar chart with profit and sales in it. On the Y axis, I need both category and subcategory. The basic approach will be just to add another level to the Y axis which will act as a drill down. But what if I say you don't need a drill down. Yes, that's possible with the use of field parameters.

Let's create one!! Go to the new parameter under modeling. Select the field parameter from there you will get a pop-up window that looks something like this. You can name your parameter and just drag the fields from the respective tables. I need only category and sub-category.

Pro tip- If you can't find the field parameter you need to go to the option and settings. In the preview feature, you need to enable the field parameter.


Once you click OK it will create a slicer (default setting). I am selecting a slicer with tiles. My visual has this parameter (parameter 1) on the Y-axis. Sales and profit on the X axis. If you check the data model you can see the parameter there. Now you can easily toggle around between categories and sub-categories.

Now, what if you want to add another field to the parameter or you want to edit the name of the fields that are showcased in the tiles. To do so go to the fields section in the report under it you can see the parameters. If you select the parameter you can see the DAX behind it. You can easily add or replace fields.

Pro tip- A very basic thing when you are using field parameters. Be aware that don't mix measures and columns in it. For eg, in our case, we took categories and sub-categories which are columns. I can add more columns to it but adding a measure to it can give you strange results.

Let's take the field parameter to the next level. Currently, we only have category and sub-category but I also want to see overall total sales and profit. To do it we are creating a calculated column " None" which contains only text. Let's adjust the parameter accordingly.


Isn't it easy? It will add another tile in your slicer and when you click it it will show overall profit and sales.


Field parameters improve the quality of your report. I prefer to use them as slicers but you can play around with them. But make sure you don't use implicit measures in field parameters always go for explicit measures. To know more about implicit and explicit measures read our blog (link).


Thanks for Reading Let's connect on LinkedIn. For more such blogs and pro tips do follow us.




Comments

Popular posts from this blog

Ultimate Beginners Guide to DAX Studio

There are zillions of external tools available with Power BI but DAX Studio is one of the most commonly used tools to work with DAX queries. It is a perfect tool to optimize the DAX and the data model. In this blog let's shed some light on the basic functionalities that can take your report to the next level. ARE YOU READY?  To start you will need the latest version of the DAX Studio. You can download it from their website . Don't worry you don't have to pay for the license. Fortunately, DAX Studio is a free tool As a BI Developer, I am using DAX Studio regularly. Based on my experience I use it for several purposes but in this blog, I will highlight the most common ones. Extracting a dump of all the measures used in your PBIX. Why do we need to do this? It can be used for documentation purposes also sometimes we try to reuse the DAX and such a dump comes in handy in this scenario. How to achieve it? Open the DAX Studio it is located under the external tools once you open t

Append v/s Merge in Power BI

Let's discuss another problem of the week. As a Power BI user, there are times when you want to combine queries. What are the ways to do so? In most cases, you can attain it by using either append or merge and both serve different purposes. Let's understand what do these terms mean in Power BI and how they are functionally different from each other.  It is quite common to get data from various sources and you need to combine those data depending on a particular column which is common in both tables so that you can add extra information or column to your big table. In such cases, we use merge queries. How to perform merge queries? For instance, I am considering Sample Superstore data and we will merge the returns table to the order table. You will find both merge and append in the home tab in extreme right in the power query editor. ProTip - You will find two options when you click on the drop-down in merge which are merge queries and merge queries as new. When you use merge que

Use Relationship in DAX

Data modeling is an essential part of creating perfect visuals. While creating complex data models there can be a case where you can find an inactive relationship represented by dotted lines and it occurs because you already have an active relationship between the two tables. But as a developer, you need to use both the relationship. How can it be done? You can use "Use Relationship" in such cases. Use relationship can be added to your DAX and act as a modifier or enhancer for calculation. It activates the inactive relation. But make sure you have an inactive relationship in place before using the use relationship function. Let's see how it works on Sample Superstore data. In my fact table I have two dates- Order date and Ship date. I am making the two relations between my date table and fact table. The relation between the sample superstore (date) to date table (date) is active while the relation between the sample superstore (ship date) to date table (date) is inactive