Forum Discussion
Anonymous
2 years agoNot applicable
Dynamically select column based on slicer for regression/correlation calculation
Hi, I have approx 400 columns & thousand of rows. All column have numerical value. My Requirement is that, Two slicers which select dynamically two different column that will represent as x & y-ax...
Greg_Deckler
Community Champion
2 years agotamerj1 OK, first of all, this is very impressive code to do the column selection. Extremely creative. Where I *think* it could be improved potentially is in your calculation of X and Y. It occurs to me that after you calculate the slope and intercept that you could create a table of the original X and Y values doing something like this:
VAR __Table = SELECTCOLUMNS( T3, "Y", [@Detail2], "X", [@Detail1] )
Once you have that, you could use ADDCOLUMNS to calculate the estimated Y for each X using the slope and intercept and X value for each row. Then you could just grab the current X value in the visual and essentially "lookup" the corresponding calculated Y value (estimated) versus the actual measurement. What do you think?
tamerj1
Community Champion
2 years agoThat is a great observation! Wow! That would potentially improve the performance significantly and make code simpler and shorter. Let me try to implement it first thing in the morning.
Thank you so much. Allways appreciate your input.