How to produce a field parameter in Power BI


Having too many slicers is almost as bad as not having enough. When slicers are jumbling your Power BI dashboard, consider changing them with parameters.

Laptop computer displaying logo of Microsoft Power BI. Image: monticellllo/Adobe Stock Slicers and filters are terrific tools for the Power BI end user, however they’re a bit limited. You can’t include simply any column to a slicer or filter and after that use up area, so what options are readily available?

In 2022, Power BI added criteria, which let designers integrate columns from different tables and columns that aren’t part of the initial visual. That implies you can use one parameter instead of several slicers to provide users a similar experience.

SEE: Hiring set: Microsoft Power BI developer (TechRepublic Premium)

In this tutorial, I’ll reveal you how to include a field criterion to a Power BI visual. We’ll compare it to a limited slicer so you can clearly see the advantages of utilizing specifications. For this tutorial, I’m using Power BI on a Windows 10 64-bit system. The demonstration file is from AdventureWorks and can be downloaded from GitHub here.

Jump to:

How to enable the field specification feature

Technically, a criterion is something you pass– usually a value passed to a snippet of code. It’s comparable in Power BI, but you’re passing a value to a visual.

More about Software

Criteria are similar to slicers and filters, enabling the end user to upgrade a Power BI visual. However, they’re more robust, due to the fact that the end user is dynamically changing the underlying columns even if they’re not part of the visual.

Before you can produce a parameter, you should make it possible for the feature. Luckily, doing so is easy. After opening the Power BI file (. pbix), do the following:

  1. Click the File tab.
  2. Select Alternatives and Settings from the left pane.
  3. Pick Options.
  4. Pick Sneak Peek Functions.
  5. Check the Field Criterion choice (Figure A).

Figure A

Enable the Field Parameters feature. Make It Possible For the Field Criteria feature.

Click OK. This will not work if you avoid this action. How to develop the visual Power BI uses two types of specifications: Fields and Numeric Range. We’re going to produce a Fields specification that lets completion user upgrade the visual shown in Figure B, which is based on the region and sales quantities in AdventureWorks.

Figure B

This simple column visually displays sales by region.

  1. This easy column visually shows sales by region. To construct the visual, do the following
  2. : Click Clustered Column Chart in the Visualizations pane. Utilizing the Fields pane, expand the Sales table and examine Sales Quantity. Broaden the Sales Territory table and check

Region. Updating the visual with slicers

Now, let’s expect completion user wishes to update this visual by product classification and nation. Let’s attempt a slicer initially:

  1. If the visual is selected, click somewhere outside that visual to remove the selection.
  2. In the Visualizations pane, click Slicer.
  3. Expand the Sales Area table, if essential.
  4. Check Nation (Figure C).

Figure C

Add a slicer based on countries. Add a slicer based upon nations. The slicer works fine, today it’s time to add a second one

  1. for the product category: If the visual is picked, click someplace outside that visual to eliminate the selection.
  2. In the Visualizations pane, click Slicer.
  3. Broaden the Item table and check Category.

Both slicers work as anticipated, but your use case requires two. Why not use one specification instead?

How to create a field criterion

It isn’t needed to include 2 slicers to the visual. A single specification can do the task, lowering the amount of location used. In this basic example, it doesn’t seem essential, but in a hectic dashboard, you and completion user might both take advantage of the streamlined operations of a specification.

Now, let’s construct a field criterion that updates by classification and country:

  1. Click the Modeling tab.
  2. Click the New Parameter dropdown.
  3. Choose Fields from the dropdown.
  4. In the resulting dialog, Power BI sets the first option to Fields and names the criterion. Rename it to Sales Specification– when working with your own information, you’ll wish to use a meaningful name.
  5. On the right, broaden the Product table and check Category.
  6. Broaden the Sales Area table and examine Nation.
  7. Uncheck the Include Slicer To This Page alternative (Figure D).

Figure D

Add fields to the parameter.

Add fields to the criterion. Click Create. Power BI adds the field criterion to the Fields pane, as you can see in Figure E. You can also see the DAX code utilized to produce the criterion. If required, you can customize this code to update the parameter.

Figure E

Power BI adds the new field parameter to the Fields pane. Power BI includes the brand-new field parameter to the Fields pane.

With the specification contributed to the Fields

pane, you can now include the specification to the visual. How to carry out the criterion Specifications are contributed to

  1. reports as slicers with the following actions: If the column visual is picked, click anywhere outside the visual to unselect it.
  2. In the Visualizations pane, click Slicer.
  3. In the Fields pane, expand the Sales Parameter.
  4. Check the Sales Parameter column to include it to the slicer visual.

Now that the parameter remains in the Fields pane, you can add it to the visual as follows:

  1. Select the column visual.
  2. Drag the Sales Specification column to the X-axis bucket (Figure F).

Figure F

Set up the parameter. Set up the parameter. Before we attempt the parameter, there are a few things you need to see. By including the parameter to the chart, you have actually upgraded the visual a bit. In addition, Power BI has included a brand-new legend to the visual, based on the specification. It updates with the X-axis because that’s the container the specification is in.

How to use the specification slicers

Utilizing the parameter slicer is simple because you utilize them the same way you would use a standard slicer. Merely click either Classification or Country in the slicer. From there, you can rapidly include a new dimension to the initial visual.

Figure G shows the visual after you’ve inspected Category. The column colors collaborate with the new legend: Bikes make the most earnings in all regions, and accessories are the items making the least.

Figure G

Click Category to see which types of products are selling the best. Click Classification to see which types of items are selling the best. Figure H reveals sales by country: The Southwest region brings in the most revenue. By utilizing the legend, you can see that the region remains in the United States.

Figure H

Click Country in the parameter slicer. Click Country in the specification slicer. Last factors to consider for Power BI users

Something we didn’t go over is the relationships between tables. Using a specification to combine columns from different tables is difficult if there’s no relationship to support them. This is probably in place, but if you can’t create the visual or a specification to upgrade it, take a look at the relationships. If this is a brand-new Power BI file, it’s possible that you’ll require to develop relationships between the tables in concern.

SEE: Hiring Package: Database engineer (TechRepublic Premium)

The more choices the end user has to manage visuals, the much better. Designers can use those opportunities by including the ideal type of filtering feature. Slicers are great, however criteria are a much better solution when you’re dealing with a busy dashboard.

Read next: Finest business intelligence tools (TechRepublic)


Leave a Reply

Your email address will not be published. Required fields are marked *