最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Azure Data Factory how to conditionally update cell based on condition of another cell in ADF (something like 'if(cell&a

programmeradmin4浏览0评论

I am relatively new to the ADF, I am trying to achieve following: Have csv file:

price new price
102
91
1145

I am relatively new to the ADF, I am trying to achieve following: Have csv file:

price new price
102
91
1145

I need to apply to both "new price" cells following function: if(A2>1000, A2*1.3, if(A2<100, A2*1.1, A2*1.2))

It easy to do in Excel, but I can not find the way how to do it in Azure Data Factory f. e. Data Flow...

I used "Derived Column" data flow and tried different expressions as well as different data types in Column A but all produced "Type Mismatch", "Expression type could not be evaluated type error.

Share Improve this question edited Apr 6 at 19:11 bealex 10k1 gold badge23 silver badges28 bronze badges asked Mar 23 at 18:26 Michael Graber - NOAA AffiliatMichael Graber - NOAA Affiliat 11 bronze badge 1
  • I found resolution by myself. – Michael Graber - NOAA Affiliat Commented Mar 24 at 17:58
Add a comment  | 

1 Answer 1

Reset to default 0

"Type Mismatch", "Expression type could not be evaluated type error. If the price column in ADF is stored as a string, it must be converted to a numeric type using toDecimal(price) to enable accurate arithmetic operations. Failure to perform this conversion may result in a type mismatch error.

1. Please use the following expression to achieve the desired results

iif(toDecimal(price) >  1000, toDecimal(price) *  1.3,
   iif(toDecimal(price) <  100, toDecimal(price) *  1.1,
   toDecimal(price) *  1.2))

2. Based on the sample data you provided; I have proceeded accordingly.

3. I have provided the following expression for use in the derived column as required.

iif(toDecimal(price) >  1000, toDecimal(price) *  1.3,
   iif(toDecimal(price) <  100, toDecimal(price) *  1.1,
   toDecimal(price) *  1.2))

4. Output is as expected as per your requirement.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论