powerbi-filed-parameters
Miquel Zelich

Miquel Zelich

Business Intelligence Consultant | Data Analyst

Other Articles:

PowerBI Field Parameters

Share on linkedin
LinkedIn
Share on facebook
Facebook
Share on twitter
Twitter
Share on whatsapp
WhatsApp

Introduction

Today we want to talk to you about field parameters. Field parameters are a new feature in Power BI, still in the preview phase, that allows us to dynamically change the dimensions or metrics used in the visualizations.

This feature is mainly intended for report readers accessing the Power Bi Service as they will be able to change the analysis object of the visualizations from a selector without having to enter edit mode.

In this example, the end-user has the ability to modify the fields by which he/she wants to group the data and the metrics to be analyzed:

parameters-dimensions-powerbi-example

Before this update, it was possible to achieve this behavior, but with more effort. At first, it only worked with metrics and the creation process was more tedious, having to create a table, either with DAX, Power Query, or with the Insert Data mode with the names of the metrics we wanted to change dynamically to create the selector. With this additional table we would create a metric using the SWITCH() function in order to link the selected value of this table with the actual metric.

This process is much easier with the help of the Field Parameters.

Enable feature:

First, we have to activate the feature

1. Make sure you have the latest version of Power BI Desktop at the time of this article,   2022.

how-to enable-field-parameters-step-1

2. We enable the preview version in File bold, > Options and settings bold, > Options bold, > Preview version features:

How-to-enable-field-parameters-step-2

3. We restart Power BI Desktop.

Create a field parameter

Once we have the feature enabled we can create the parameters.

1. To create them, go to Modeling and select New parameter bold, > Fields:

how-to-create-a-field-parameter-step1

2. In the window we select the fields we want to add in the field selector:

how-to-create-a-field-parameter-step2

With these steps, Power BI will create a selector in our report with the selected fields and a table with DAX with 3 columns: name of the field, real name of the column, and order of the different fields. This table allows us to create the selector.

how-to-create-a-field-parameter-step3

*The first column is the name that will be displayed in the visualization and can be modified directly in the DAX code. You can also add a new parameter following the same structure.

Use of the field parameters

With all created now, we only need to add the parameter field in our visual object. In this case, we have created a selector with dimension fields so we will add the field on the Y axis:

dimension-field-selector

The selector allows us to change the field we can group by

selector-for-change-field-parameters

In the same way, we can create a field parameter with created metrics and change the analyzable metrics.

change-metrics-in-a-field-parameter

And in this way be able to interact with the two selectors:

Field-parameter-selectors

If more than one field of the selector is selected, all selected fields will be shown in the display.

Concluding remarks

For this feature to work well and in any field, it is very important to have a well-defined model and a star model as it allows us to get the most out of Power BI and ensure the correct use of the model relationships.

Deja un comentario

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

Business Data Master Logo

No te pierdas el

WEBINAR
Gratuito

Explicaremos en detalle los contenidos y objetivos del Business Data Master

29/11/2021

18:30 (GTM+1)

Online

BUSINESS DATA MASTER

* Tu información será utilizada exclusivamente para contactarte en relación al Business Data Master. No hacemos spam ni compartimos datos con terceros.