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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
tylersbrown01
Frequent Visitor

How to calculate a metric despite direct query limitations

I build line charts for manufacturing companies to help them keep their processes under control. If a variable value trends above or below a SPEC LIMIT (just a solid line defining the limits of an acceptable measurement for a given variable), then manufacturing is stopped and problem is corrected. Now, they want me to predict these issues before they occur.One way to predict to do this is to calculate Cp (process capability) 

 

The forumula for CP is: Cp = ([upper spec limit - lower spec limit]) / ([STD DEV] * 3)

I'm having trouble calculating this formula in DAX under the direct query connection model. 

Here is how my schema is set up (only two tables requird to understand this) 

 

 

I'm calculating CP as a measure inside fact_product_variable, which contains many values for each variable listed in the dim_variable table. dim_variable contains the USL and LSL values I need. To make this calculation work, for each variable name, I need to calculate a CP value.

This is the DAX formula I attempted to write.

 

Cp2 = SUMX (
	fact_product_variable,
	CALCULATE(
		SUMX (
			dim_variable,
			(dim_variable[usl] - dim_variable[lsl]) / ([StdDev] * 3)
		)
	)
)

 

I'm not sure if this is correct or not but it was my best shot. After typing the formula, I get an error saying Function 'SUMX is not supported in this context in DirectQuery mode.

Is it even possible to calcualte Cp under these constraints? If so, what do I do? Thanks!

1 REPLY 1
v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @tylersbrown01,

 

By default, limitations are placed on DAX expressions allowed in measures when you connect the SQL Server in Direct Query mode. For bypass this limitation, you’d better select File -> Options and then Settings -> Options -> Direct Query, then selecting the option “Allow unrestricted measures in Direct Query mode”. When that option is selected, any DAX expression that is valid for a measure can be used.

AS I tested, the SUMX function works fine in Direct Query mode and get desired result after settings. Please set up your Power BI desktop and check if it still have the issue. For more details, please review this article.

1.png

If you have any other question, please feel free to ask.


Best Regards,
Angelia

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors