Forum Discussion
DAX Polynomial Regression Calculation Issue
- 5 years ago
I think the main problem here is this: COUNTX(VALUES(Table1[date]),Table1[date])
This is evaluated within the local filter context and returns 1 for each row corresponding to a single date.
Try this instead: COUNTROWS ( ALLSELECTED ( Table1[date] ) )
I think the main problem here is this: COUNTX(VALUES(Table1[date]),Table1[date])
This is evaluated within the local filter context and returns 1 for each row corresponding to a single date.
Try this instead: COUNTROWS ( ALLSELECTED ( Table1[date] ) )
- Anonymous5 years agoNot applicable
Thank you for your input, however that did not seem to have any effect. Would that have an effect on the final return result if that var only returns a single number of the count?
- AlexisOlson5 years agoSuper User
This is what I get when I make that change:
Good match except for x = 1.
Note that you need to make the same change for each of [a], [b], [c] or else change your final line of [values (poly fit)] to a*[zSequence1ToN]^2+b*[zSequence1ToN]+c (use the variables you've already computed instead of referencing other measures).
- Anonymous5 years agoNot applicable
That's a facepalm moment. I was indeed using the measures instead of the variables. Thanks!
So the moral of the story is that local filter context is passed down through dependent variables too. That is something I would not have considered.