Home > Back-end >  How to Add a conditional expression in Azure Dataflow Window Transformation
How to Add a conditional expression in Azure Dataflow Window Transformation

Time:11-15

Can Any one say How to add a iif conditional expression in window function under window Columns .I want to give the following : iif(ID>5,(lag(op_hours,0) lag(op_hours,1) lag(op_hours,2) lag(op_hours,3) lag(op_hours,4) lag(op_hours,5))/6,toDouble(4455))

under WindowColumns. But expression builder throwing like "Columns should be wrapped within aggregate/Window functions" at ID>5.

Please help guys

Can Any one say How to add a iif conditional expression in window function under window Columns .I want to give the following : iif(ID>5,(lag(op_hours,0) lag(op_hours,1) lag(op_hours,2) lag(op_hours,3) lag(op_hours,4) lag(op_hours,5))/6,toDouble(4455))

under WindowColumns. But expression builder throwing like "Columns should be wrapped within agregate/Window functions" at ID>5

CodePudding user response:

How to Add a conditional expression in Azure Dataflow Window Transformation

In windows transformation we cannot give column name as single entity We have to pass it with the Aggregate function or Windows function

I tried to reproduce your scenario and getting similar error:

enter image description here

To work around that I performed below steps:

First, I created column as Net Sales and gave the Lag expression to the windows Transformation To get the exact value:

enter image description here

It gave the output with Lag expression to all the values for particular window.

enter image description here

After I created a derived column with the same name and passed the conditional statement as

iif(Id>5,{ Net sales },toDouble(4455))

It is updating the Net Sales column values which have Id greater than 5 to decimal of 4455.

enter image description here

Output:

enter image description here

  • Related