Forum Discussion
Dynamically select column based on slicer for regression/correlation calculation
tamerj1 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:
That 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.
- Greg_Deckler2 years ago
Community Champion
tamerj1 Nevermind that last one, I forgot that you are using field parameters so all you will get back is the value of the parameter "Open", "Closed", etc. not the actual value for the x-axis. I think that might invalidate the previous thought I had as well. If you can't know the current value of the X-Axis then I don't think either approach will work.
- Greg_Deckler2 years ago
Community Champion
tamerj1 Now that I'm thinking about it, you could actually just grab the current value of X using MAX and calculate the estimated Y using the slope and intercept, no need for the intermediate table. I *think*!
- tamerj12 years ago
Community Champion
Greg_Deckler
I'm not sure I fully understand this point. Please clarify further.
I wasn't able to try your previous suggestions today. I hope will be able to do it tomorrow. I'm so exited to finding a more simplified solution.