Forum Discussion
Request for Field Parameters Feature in Power BI Report Server (RS) Version
Thank you lbendlin
Hi, Suntime
Your idea is great. You can submit your current idea in ideas forum and vote for it so that Power BI can know more users need this feature and release it in future versions.
An alternative solution is proposed below.
Sample data based on Power BI:
First, I created a calculated table using the following DAX expression:
Dynamic axis Table =
VAR _city = SELECTCOLUMNS(ADDCOLUMNS(VALUES(financials[Country]),"Target","Country"),"Target",[Target],"Target detial",'financials'[Country])
VAR _year = SELECTCOLUMNS(ADDCOLUMNS(VALUES(financials[Year]),"Target","Year"),"Target",[Target],"Target detial",'financials'[Year])
RETURN UNION(_city,_year)
Use the following DAX expression to create a measure:
Data =
IF(HASONEFILTER('Dynamic axis Table'[Target]),
SWITCH(TRUE(),
SELECTEDVALUE('Dynamic axis Table'[Target])= "Country",CALCULATE(SUM(financials[ Sales]),TREATAS(VALUES('Dynamic axis Table'[Target detial]),'financials'[Country])),
SELECTEDVALUE('Dynamic axis Table'[Target])= "Year",CALCULATE(SUM(financials[ Sales]),TREATAS(VALUES('Dynamic axis Table'[Target detial]),'financials'[Year]))
),
ERROR("don't select two x axis")
)
Use these fields in your chart:
Through the slicer we can dynamically switch the coordinate axis to realize the role of the field parameter:
Regarding the dynamics of the metrics, first I have the following two metrics:
Create the following Table:
Create the following metric:
Data measure = SWITCH(TRUE(),
SELECTEDVALUE('Dynamic Measure Table'[Measure]) = "Sales YTD",[ Sales YTD],
SELECTEDVALUE('Dynamic Measure Table'[Measure]) = "Sales running total",[ Sales running total]
)
To dynamically switch measure values in a slicer:
The only shortcoming of this approach is that it only supports single selection. Other functions are similar to field parameters, allowing users to continue to switch dimensions/measures freely.
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This workaround using measures can only be applied to the value area of Power BI matrix (table) visual controls, not to the row and column areas. What I need is automatic field switching for the row and column areas.
这种采用度量值的变通解决方法,只能应用 POWER BI 矩阵(表格)视图控件的值区域,不能应用到行、列区域,我需要的是作行、列区域的自动字段切换