Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
tkmiro
Regular Visitor

Report builder - how to dynamically change column name in DAX query?

Hello everybody.

I came across this problem: I have separate measures for every month of year in my model. Something like this: VALUE_01, VALUE_02, VALUE_03, ... VALUE_12. (don't ask me why it is like this) I need to therefore use different measure based on what period user selects in filter. I don't want to query all 12 measures since it could affect performance by querying large amount of unnecessary data. (or would it? does querying measures affect performance when I don't use them in report?) So what I would like to do is to use query parameter in my DAX query, but I want to modify the column name with this parameter. Let's say I want measure VALUE_04 it should look something like this: [VALUE_@PeriodNumberParameter]

Is something like this possible?

Thanks a lot in advance!

3 REPLIES 3
v-luwang-msft
Community Support
Community Support

Hi @tkmiro ,

As far as I know, there seems to be no way to pass parameters to measure, see the following article:

How to create a dynamic measure name in Power BI?

 

 

Best Regards

Lucien

Hello, I think what I'm looking for is possible. I found solution online which looks like it should work (and apparently it worked for somebody else) but it does not work for me. You can press "fx" button in dataset properties next to place where you write your query. In expression editor you can put "=" before  your query and edit your query like a string using parenthesis. I tried it and I can concatenate strings in the query, even in column or measure names. However, passing in parameters doesnt work, even though it worked in an online example I've found.

 

Anyway, thanks for a reply.

I found the source where it seems to be working for someone: sql server - How to correctly set expression Query.CommandText in SSRS? - Stack Overflow

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.