Azure Synapse convert value in row

Viewed 63

In an Azure Synapse Dataflow, for every row where the field value in column "Name" starts with "F-" synapse, I want to change the value from column "Price" to an absolute value of the price.

Which Mapping data flow transformation can I use and which expression must I use? I have tried the "alter Row" transformation but I couldn't get the expression done.

For example:

Original:

Name Price
P-12344 -21354,45
S-12335 12543,45
F-13564 54,45
F-112344 -1254,45

Output:

Name Price
P-12344 -21354,45
S-12335 12543,45
F-13564 54,45
F-112344 1254,45
1 Answers

You can use derived column transformation and abs() function in data flow.

Please go through the sample demonstration below:

Source data:

I have given String type to Name column and integer type to Price column in the projection of the source.

enter image description here

Derived column transformation:

Give the below expression

iif(startsWith(Name,"F"),abs(Price),Price)

enter image description here

Result in Data preview:

enter image description here

You can give the same source in the sink.

Related