We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Calculate Previous Year Value in columns

Mahabirpanigrahi
8 - Asteroid
HI Alteryx Experts, Need your help in calculating Previous Year Value in the column to the table. Have attached the data here, where i have shown my desired output in yellow color. I have tried a long process, thought checking with community for a better/easiest way to build this Appreciate in advance for help. Thanks Mahabir.
10 REPLIES 10
Qiu
21 - Polaris
21 - Polaris

@Mahabirpanigrahi 
We maybe can use the Multi-Row tool here.

0329-Mahabirpanigrahi.PNG

Tyro_abc
11 - Bolide

Hi @Mahabirpanigrahi 

 

The attached workflow would give you the previous year's value. 

 

Step1: Sort by Market, Product, SKU, and Period

Step 2: Use Multi-Row Formula Tool to read the Previous year value for the same combination ( mentioned in Group By Clause) 

Step 3: Same as Step 2 but for another measure.  

 

Tyro_abc_0-1648516179747.png

 

Happy to help, 

 

Regards

Arundhuti

Mahabirpanigrahi
8 - Asteroid

HI @Tyro_abc  & @Qiu  - Appreciate your help! 

 

It worked on the file that was shared, but when I add more months to the file. both the model doesn't work?

 

Can you please check and advise?

Tyro_abc
11 - Bolide

That solution was based on the data you provided. If you have more than one row for a particular Market, Product, SKU, Year combination, you can simply add them and then use the multi-row tool. Accordingly, we need to adjust the formula

 

 

Tyro_abc_0-1648706472588.png

 

Regards

Arundhuti

Qiu
21 - Polaris
21 - Polaris

@Mahabirpanigrahi 
Previously It is only considering the Year, ignoring the Month.
now I thin you are saying that the same month of last year.

0329-Mahabirpanigrahi-01.PNG

Mahabirpanigrahi
8 - Asteroid

thank you! Seems the file you attached is the old file. Request to share the revised on.

Tyro_abc
11 - Bolide

sorry about that, here you go. Use the second excel you attached with this workflow.

 

 

Regards

Arundhuti

Mahabirpanigrahi
8 - Asteroid

Hi @Tyro_abc 

 

Seems there is confusion. I wanted to PY data by each month. 

 

Attached is the image of what I expect to be the outcome. 


Request to have a look. 

 

Thanks

Mahabir

 

 

Kamran1991
11 - Bolide

Hope attached solution will address you query.

Labels
Top Solution Authors