Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
 AlexisOlson
		
		
		
		
		
		
		
		
	
			 on 
    
	
		
		
		02-17-2023
	
		
		02:09 PM
		
			AlexisOlson
		
		
		
		
		
		
		
		
	
			 on 
    
	
		
		
		02-17-2023
	
		
		02:09 PM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
		
	
				
		
	
		I've been trying to incorporate LINESTX into my reporting but keep running into errors when modifying the filter context.
To create a minimal reproducible example, I've loaded a data table like this:
and defined a measure as follows:
LINEST_Intercept = 
VAR Summary =
    ADDCOLUMNS (
        VALUES ( Data[ID] ),
        "@Y",  CALCULATE ( SUM ( Data[Y]  ) ),
        "@X1", CALCULATE ( SUM ( Data[X1] ) ),
        "@X2", CALCULATE ( SUM ( Data[X2] ) )
    )
VAR Coeffs = LINESTX ( Summary, [@Y], [@X1], [@X2] )
VAR Intercept = SELECTCOLUMNS ( Coeffs, "Intercept", [Intercept] )
RETURN
    Intercept
This works fine initially in a matrix like this:
However, if I add a slicer on ID and make any selection other than the full range, I get an error on the entire visual.
Error Message:
MdxScript(Model) (4, 1) Calculation error in measure 'Data'[LINEST_Intercept]:
A table of multiple values was supplied where a single value was expected.
If I try using MAXX instead of SELECTCOLUMNS inside my measure
VAR Intercept = MAXX ( Coeffs, [Intercept] )
and filter the ID, I either get "An unexpected exception occurred" or weird results with a blank Group like this:
None of this weirdness happens if I use a different function that returns a single row like TOPN ( 1, ... ).
Please see the attached sample file.
Tagging a few people for awareness. Please ignore if you aren't interested.
@jeroenterheerdt, @marcorusso, @Greg_Deckler, @ValtteriN, @CNENFRNL, @tamerj1, @wdx223_Daniel, @smpa01
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
 mattlee
		
		
		
		
		
		
		
		
	
			
		
					on:
					Error:Visuals display blank when export report to ...
		
			mattlee
		
		
		
		
		
		
		
		
	
			
		
					on:
					Error:Visuals display blank when export report to ...	
				 on:
					New Button Slicer: Issue with the Grid type of Arr...
		
		
		
		
		
	
			
		
					on:
					New Button Slicer: Issue with the Grid type of Arr...	
				 mattlee
		
		
		
		
		
		
		
		
	
			
		
					on:
					List Slicer Button Dimensions Ignored in Service
		
			mattlee
		
		
		
		
		
		
		
		
	
			
		
					on:
					List Slicer Button Dimensions Ignored in Service	
				 on:
					BUG: report connected to deleted semantic model ca...
		
		
		
		
		
	
			
		
					on:
					BUG: report connected to deleted semantic model ca...	
				 on:
					Deployment pipelines don't support M365 groups
		
		
		
		
		
	
			
		
					on:
					Deployment pipelines don't support M365 groups	
				 Hongju_Jung
		
		
		
		
		
		
		
		
	
			
		
					on:
					A Typo about Measure tools (Korean)
		
			Hongju_Jung
		
		
		
		
		
		
		
		
	
			
		
					on:
					A Typo about Measure tools (Korean)