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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Dave82
Frequent Visitor

How to load a DAX Expression into a Measure/yAxis?

So high level, I'm looking to bring in my x/y axis calculations for a report from a metadata table in my database.  I have the following DAX expression I put in a Measure that works when I reference MOPR in the y-axis column value:

MOPR = Sum(mview_PARTS[PM_GOOD_TNE_PROD])/Sum(mview_PARTS[TRGT_PM_Prod])*100

 

So I created a parameter called yAxisExpression and loaded the above calc into it in the Power Query Editor and I want to bring the parameter's value into my y-axis.  So I tried a measure like this:

mtest_Measure = 'yAxisExpression'[yAxisExpression]

 

I get the following error:

A single value for column 'yAxisExpression' in table 'yAxisExpression' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.

 

I can't seem to find much info on how to reference a parameter like this.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Dave82,

So you mean you want to create a query parameter in the query editor and you want to extract that parameter value in DAX expressions?

If that is the case, I'd like to suggest you turn on the 'enable load' option of the parameter to enable power bi to transform and generated the data model table then you can use Dax aggregation functions to extract parameter table values. (e.g. min, max )

BTW, current power bi does not support working with measure expressions at the axis or legends fields. So if you want to use the custom field as the chart axis, please create a calculated table instead. After these steps, you need to write a measure on the value field to interact with the axis/legend and calculate results based on the current axis.

Regards,

Xiaoxin Sheng

View solution in original post

6 REPLIES 6
AlexisOlson
Super User
Super User

I'm not sure I understand why you're creating a new parameter. Doesn't [MOPR] work as your y-value?

I want to switch the yaxis value dynamically while storing the calculations in a database table

Sorry. I don't follow what you mean.

 

Can you give an example of what you're trying to switch between?

I just need to know how to get a parameter value and load the text into a measure?  Is that possible?

Anonymous
Not applicable

Hi @Dave82,

So you mean you want to create a query parameter in the query editor and you want to extract that parameter value in DAX expressions?

If that is the case, I'd like to suggest you turn on the 'enable load' option of the parameter to enable power bi to transform and generated the data model table then you can use Dax aggregation functions to extract parameter table values. (e.g. min, max )

BTW, current power bi does not support working with measure expressions at the axis or legends fields. So if you want to use the custom field as the chart axis, please create a calculated table instead. After these steps, you need to write a measure on the value field to interact with the axis/legend and calculate results based on the current axis.

Regards,

Xiaoxin Sheng

I'm still not sure what you're asking, so I don't know if it's possible.

Helpful resources

Announcements
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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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