This article covers how you can use Power BI field parameters to handle measure names dynamically. The solution is simple and effective. I have covered this topic already on my YouTube channel and got very good feedback (added here). Explained the same topic here for everyone benefit.
YouTube Video
Let me explain this concept in scenario and solution format using field parameters.
Scenario
Lets assume we need to build multiple measures like below with the exact names and show them in visual.
- Current Year Sales
- Last Year Sales
- Last Year – 1 Sales
The above names are more generic and help understand anyone but what if we give more specific names like below,
- January 2025 Sales
- December 2024 Sales
- November 2024 Sales
The above names help anyone to understand easily than previous generic name.
Field Parameters
It is an intereting feature in Power BI. It can be easily created in Power BI Desktop->Modeling->New parameters -> Fields
Detailed information about Field Parameters is available in Microsoft learn – Field Parameters
Solution
Consider I have below setup where I have added all the measures in the Table visual.
Create a field parameter using the measures and it will create a new DAX table like below.
The above table has 3 columns, we need to focus on the first column which is static now. It is nothing but the measure name that we provided. As we need a dynamic name, we can modify that hard corded values into dynamic expression like below for all the rows.
The final result would look like below.
When you use the field parameter on the table visual then it will be like below.
Thats it. We got the expected result. Happy Learning!!
Leave a Reply