Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.
Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Macro Error while trying to create a Group By for Linear Regression

sunil_kambrath
6 - Meteoroid

Hello,

I need your help to fix a simple Macro error "...Parse Error at char(9): Unknown variable Product.." which I am not able to fix even after spending many hours.

I am trying to run linear regression in batch modes using all combinations of 2 key dimensions in data. Since Linear Regression tool doesn't have a Group By option I am trying to do it using a macro. 

 

The input data consists of few metrics (sales, pricing, distribution) and two key dimensions markets and products. I wanted to subset the data for each Market and  Product combination and pass it to the Regression tool to run iteratively. 

Macro_Error.JPG

Thanks! 

 

6 REPLIES 6
Thableaus
17 - Castor
17 - Castor

Hi @sunil_kambrath 

 

I made some modifications to your worklow and macro.


Please take a look and see if this fits well to your needs. You might need to replace the Model Coefficients macro since mine is attached to my Predictive tools palette. 

 

Cheers,

RishiK
Alteryx
Alteryx

@sunil_kambrath 

 

You are getting the error because the Product field is of type String 9 and in the Filter tool (within your Macro) you are searching for a literal value of "P" via Product = "P".  What are you trying to do in the filter?  I assume you maybe want to search whether the Product value contains a "P", if this is the case you can use the Contains function such as Contains([Product],"P") in the filter.

 

This is why you are getting the error.

WilliamR
Alteryx
Alteryx

Here is a workflow which works. Same as previous, I have removed the tool in the macro.

I have used just one action to modify the entire filter condition.

Hope it helps.

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

sunil_kambrath
6 - Meteoroid

Thanks for the solution Thableaus!  It works fine now.  

sunil_kambrath
6 - Meteoroid

Thanks Rishi! The literals "P" and "M" are just placeholders to feed values of Product and Market respectively from the Input dataset. Anyways the solution @Thableaus worked for me. He removed all action tools and directly fed the values to filter tool through control. Thanks again for your support. 

sunil_kambrath
6 - Meteoroid

Thanks WilliamR for the help. I tried the modified version you sent, it is not working. It just have one control parameter and hence not updating the filter condition values which is expecting 2 sets of values. Thanks for your time and much appreciated. 

Labels
Top Solution Authors