From f2c237e172926a79036a73c2fc5e73b686f5e073 Mon Sep 17 00:00:00 2001 From: rfernandezdo <39990341+rfernandezdo@users.noreply.github.com> Date: Fri, 19 Mar 2021 13:25:41 +0100 Subject: [PATCH] Update README.md Fix iif(locate('|',genres)>1,left(genres,locate('|',genres)-1),genres) --- data30/demos/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/data30/demos/README.md b/data30/demos/README.md index 7bca68c..2166be6 100644 --- a/data30/demos/README.md +++ b/data30/demos/README.md @@ -86,7 +86,8 @@ Click Close, then click on the **pipeline1** tab and drag the green box from yo In this scenario, you are trying to extract the first genre from the genres column which is formatted as 'genre1|genre2|...|genreN'. Use the **locate** function to get the first 1-based index of the '|' in the genres string. Using the **iif** function, if this index is greater than 1, the primary genre can be calculated via the **left** function which returns all characters in a string to the left of an index. Otherwise, the PrimaryGenre value is equal to the genres field. You can verify the output via the expression builder's Data preview pane. - Your expression should look like: iif(locate('|',genres)>1,left(genres(locate('|',genres)-1),genres) + Your expression should look like: iif(locate('|',genres)>1,left(genres,locate('|',genres)-1),genres) + 1. **Rank movies via a Window Transformation** Say you are interested in how a movie ranks within its year for its specific genre. You can add a [Window transformation](https://docs.microsoft.com/azure/data-factory/data-flow-window) to define window-based aggregations by clicking on the **+ icon** next to your Derived Column transformation and clicking Window under Schema modifier. To accomplish this, specify what you are windowing over, what you are sorting by, what the range is, and how to calculate your new window columns. In this example, we will window over PrimaryGenre and year with an unbounded range, sort by Rotten Tomato descending, a calculate a new column called RatingsRank which is equal to the rank each movie has within its specific genre-year. @@ -149,4 +150,4 @@ Another option is to switch to the Azure Portal, expand the data warehouse blade select count(*) from dbo.Ratings ``` -💡 NOTE - At the end of this demo, if you are NOT going through any other demos - delete the resource group to reduce and mimize Azure spend. \ No newline at end of file +💡 NOTE - At the end of this demo, if you are NOT going through any other demos - delete the resource group to reduce and mimize Azure spend.