Field Parameters in Power BI


Scenario:

The May 2022 version of Power BI Desktop includes a very interesting and useful feature – Field Parameters. To better help you understand this new function, I would like to generally introduce it and share with you about some common application scenarios.

 

Introduction

Field: a table column or measure.

Parameters: is a variable.

Field parameters: Field parameters allow users to dynamically change the measures or dimensions being analyzed within a report. We can use the parameter to control the measures or dimensions used in a visual.  

 

The parameter table has three columns, the first is the parameter name, which is the name displayed in the slicer, the second is the field source (measure and column), and the third is the parameter order.

yingyinr_0-1655886103938.png

 

PS: Some people may ask, is it possible to add a field parameter to be blank? Not currently. If we add a blank field, an error occurs when rendering the report.

yingyinr_1-1655886285333.png

yingyinr_2-1655886285335.png

 

Steps:

Original Table:

a) Table

Date

sales

StorelD

YMonth

Product

quantity

Salemanager

3/1/2022

56

2

2022-3

Product6

5

Amy

4/3/2022

40

1

2022-4

Product6

10

Amy

1/2/2022

49

3

2022-1

Product3

7

Amy

1/22/2022

53

2

2022-1

Product4

3

Amy

2/11/2022

52

1

2022-2

Product3

5

Helen

3/3/2022

33

1

2022-3

Product4

9

Helen

3/23/2022

22

3

2022-3

Product5

8

Helen

4/12/2022

27

2

2022-4

Product2

6

Paul

3/1/2022

35

1

2022-3

Product3

12

Paul

4/3/2022

33

3

2022-4

Product5

2

Paul

1/2/2022

57

3

2022-1

Product6

5

Paul

7/1/2022

57

1

2022-7

Product1

8

Paul

7/21/2022

41

3

2022-7

Product3

7

Paul

3/3/2022

43

3

2022-3

Product4

9

Wendy

3/23/2022

42

1

2022-3

Product2

3

Wendy

4/12/2022

47

3

2022-4

Product2

4

Wendy

3/1/2022

25

1

2022-3

Product6

6

Wendy

4/3/2022

37

3

2022-4

Product5

5

Wendy

1/2/2022

53

3

2022-1

Product2

3

Wendy

 

b) City

 

Scenario 1: Dynamic Coordinate Axis

Click New Parameter > Field, in the pop-up window, all fields in the model can be selected on the right:

When creating a clustered column chart, the x-axis is generally a fixed field. If we want the x-axis to be dynamically changed according to different selections of the slicer, we can use buttons + bookmarks to achieve this, but it is relatively complicated; So we can use the field parameter to easily change x-axis dynamically through the slicer selection.

yingyinr_3-1655886418122.png

 

Scenario 2: Dynamic Values

When using the measure as the value or Y-axis in the chart, different values can be displayed dynamically, and different data formats (integer or percentage) can be displayed. Create a new field parameter and add sales measure and quantity measure. Then as the Y-axis of the chart. The displayed results show:

yingyinr_4-1655886418142.png

 

What’s more: the value or Y-axis here can only be the measure, when using column fields. The graph will appear blank.

yingyinr_5-1655886418143.png

Scenario 3: Full Dynamic chart

The first two scenarios are for the dynamic display of the X-Axis and values, so the combination of the chart will naturally be full dynamic display. Create three different field parameters: X-axis, Y-axis or value, Legend. And add them to their respective locations. The display is as follows:

yingyinr_6-1655886502294.png

 

 

Summarize
Field Parameters VS SWITCH TRUE

If you want to dynamically switch values, we can also use the SWITCH TRUE method. However, the value returned by the SWITCH TRUE method can only be in one format, and Field Parameters can dynamically display values in different formats.

 

In short, Field parameters enable dynamic dimensions and calculations, Including: dynamic axis, dynamic legend and dynamic value.

Field parameters are useful because they allow users to seamlessly change the columns used in visual objects. Field parameters can provide a very customizable user experience.

 

 

Author: Yalan Wu

Reviewer: Ula Huang, Kerry Wang

Field Parameters in Power BI.pbix



Source link

Be the first to comment

Leave a Reply

Your email address will not be published.


*