Question on Iterate Column

I understand how to use iterate column when specifying a column name, I want to do something just a little bit different. I want to apply the same formula to a set of columns using a value in another column in the same row.

Example

Table has 5 columns - Model#, Price1,Price2,Price3,Std_Disc_Pct

I want to replace value in each of the “PriceX” columns using the formula (PriceX value * Std_Disc_Pct value for that row). My issue is that my table has 158 “PriceX” columns and I don’t want to have to create an indiviual calculation for each “PriceX” column, I just want to loop through the columns and apply the formula. The “Std_Disc_Pct” will be different for each row so I need to “row” process the dataset.

Any help would be greatly appreciated.

Thanks,

Keith

I would unpivot all the PriceX columns, did the multiplication, and then pivoted them back.

See the example below.

multiply columns.morph (2.5 KB)
data.txt (63 Bytes)

If the table is too big to unpivot the entire table at once, you can unpivot it line by line using the technique described in my earlier answer here: