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.

Fetching Data From the Different column

Alteryxexpert
8 - Asteroid

I have data like below,

DateProductSalesForecast Sales
Jan-25Chair200500
Feb-25Chair304655
Mar-25Chair850700
Apr-25Chair0800
May-25Chair0900
Jun-25Chair0855
Jul-25Chair0755
Aug-25Chair0988
Sep-25Chair0888

 

In sales whenever it is 0 i need to populate the previous month forecast sales value, ex for apr-25 I need to populate sales as 700(Mar-25 Forecast sales) like below, there are lot product in the product column for all this needs to be calculated in the same way.

DateProductSales
Jan-25Chair200
Feb-25Chair304
Mar-25Chair850
Apr-25Chair700
May-25Chair800
Jun-25Chair900
Jul-25Chair855
Aug-25Chair755
Sep-25Chair988

 

How to do this in alteryx?

5 REPLIES 5
davidskaife
14 - Magnetar

Hi @Alteryxexpert 

 

The Multi-Row Formula tool is the one to use for this, configured like below:

 

Screenshot 2025-05-29 113254.png

 

Note: ensure you tick Group By Product, and that your data is sorted in date order

abacon
12 - Quasar

@Alteryxexpert Use a multi-row formula tool.

If [Sales]=0 then [Row-1:forecast sales] else [forecast sales] endif.

 

This tool will take the previous row record of the value you choose.

 

Bacon

caltang
17 - Castor
17 - Castor

To visualise it:

 

image.png

 

Please add the group by element accordingly if you have Dates or Products... since it's a sample dataset, I don't know if there is this requirement or not. 

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
AlteryxTrev
10 - Fireball

As others have mentioned above, this can be done primarily with the Multi-Row Formula tool. However, I've taken it one step further to assure the data is in the correct order, since order matters when looking at adjacent rows.

 

1. convert your date (that is a sting) to a date field using the DateTime tool. You will need to use a Custom format to match you specific data (MMM-yy).

2. Sort your newly created date field ascending to guarantee your dates are in order. 

3. Use the Multi-Row Formula tool to populate your data accordingly. Namely, this can quality if something is true/false in the current row and depending on that outcome can populate it with values from another row.

 
 

Screenshot 2025-06-04 215109.png

Screenshot 2025-06-04 215148.png

  

 

AlteryxTrev
10 - Fireball

Here's a quick video I made explaining the above in a bit more detail. Hope it helps!

 

https://youtu.be/XLDtmfffWig

In this video, I respond to a real question from the Alteryx Community - how to replace zero sales values with the previous month's forecast value using Alteryx tools. 🔧 Tools used in this workflow: DateTime Tool - Convert custom date strings to actual Date format (MMM-yy) Sort Tool - Ensure ...
Labels
Top Solution Authors