Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
nezuko_kamado
Creator
Creator

How to normalize or standardize numeric column?

In load script, I use 

(Price- min(Price)) /(max(Price)-min(Price)) as normalized_Price

then error comes with "Invalid expression"

Any idea why this is invalid expression? How can I apply normalization or standardization to column?

Labels (3)
3 Replies
anat
Master
Master

(sum(Price)- min(Price)) /(max(Price)-min(Price)) as normalized_Price

nezuko_kamado
Creator
Creator
Author

It says it's invalid expression..😥😢

nezuko_kamado_0-1708967175387.png

 

hic
Former Employee
Former Employee

You need a "Group By" in your Load statement. Otherwise the Min() and Max() will not work.

Something like

tmpData:
Load
ProductGroup,
Price
From Table;

Left Join
Load
ProductGroup,
Min(Price) as MinPrice,
Max(Price) as MaxPrice
From Table Group By ProductGroup;

Data:
Load
(Price-MinPrice) /(MaxPrice-MinPrice) as normalized_Price,
*
Resident tmpData;

Drop Table tmpData;