<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Challenge #1 Employees transition between departments using the Sankey chart in Incorta Conundrums</title>
    <link>https://community.incorta.com/t5/incorta-conundrums/challenge-1-employees-transition-between-departments-using-the/m-p/3348#M6</link>
    <description>&lt;P&gt;I am solving this challenge using the power of Incorta's no-code/low-code capabilities. &lt;/P&gt;
&lt;P&gt;1.) Upload the CSV files, create a schema and create tables for the department.csv and dept_emp.csv files. &lt;/P&gt;
&lt;P&gt;2.) Create aliases of department and dept_emp.&lt;/P&gt;
&lt;P&gt;3.) Join dept_emp to the department on the dept_no. Join dept_emp to its alias with the below joins. Join the dept_emp alias to the department alias on dept_no. &lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2022-11-23 at 4.39.49 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.incorta.com/t5/image/serverpage/image-id/1750iD0FA1C5100E1CE2A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2022-11-23 at 4.39.49 PM.png" alt="Screen Shot 2022-11-23 at 4.39.49 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;4.) Add a Formula Columns to the dept_emp table with the Column Formula of 1. We are creating this because at this time, the Sankey only supports sums and not counts. &lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2022-11-23 at 4.43.14 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.incorta.com/t5/image/serverpage/image-id/1751i0F5366E6E0135148/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2022-11-23 at 4.43.14 PM.png" alt="Screen Shot 2022-11-23 at 4.43.14 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;5.) Create an Aggregate Table insight. Put the Dept Name from the department table in the Grouping Dimension. Put the Dept Name from the department alias table in the Grouping Dimension below the other Dept Name, I recommend renaming it not to confuse the two. The formula column you created should be in the measure. To filter only on transfers, grab any column from the dept_emp alias table, place it in the Individual Filter, and only show Not Null records. &lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2022-11-23 at 4.44.54 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.incorta.com/t5/image/serverpage/image-id/1752iCC0E1052B52E7357/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2022-11-23 at 4.44.54 PM.png" alt="Screen Shot 2022-11-23 at 4.44.54 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;6.) Change the Insight into a Sankey and add the formula column you created as the Sort By of the Dept Name in the Source. &lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2022-11-23 at 4.51.23 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.incorta.com/t5/image/serverpage/image-id/1753iAA10FC308286A3BA/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2022-11-23 at 4.51.23 PM.png" alt="Screen Shot 2022-11-23 at 4.51.23 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt; Here is the diagram of my Sankey schema for this challenge. &lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2022-11-23 at 4.38.33 PM.png" style="width: 400px;"&gt;&lt;img src="https://community.incorta.com/t5/image/serverpage/image-id/1754i5628D50C0640B749/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screen Shot 2022-11-23 at 4.38.33 PM.png" alt="Screen Shot 2022-11-23 at 4.38.33 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The join between the dept_emp and alias of dept_emp only works because the to date from the previous department matches the from date of the new department. If this was different we would have to create a different solution using Incortas &lt;A href="https://docs.incorta.com/5.1/concepts-join-filter" target="_self"&gt;First Version filter&lt;/A&gt; or SQL/Pyspark. &lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2022-11-23 at 5.00.42 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.incorta.com/t5/image/serverpage/image-id/1756i65D09483148CF314/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2022-11-23 at 5.00.42 PM.png" alt="Screen Shot 2022-11-23 at 5.00.42 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;</description>
    <pubDate>Wed, 23 Nov 2022 22:01:26 GMT</pubDate>
    <dc:creator>john_cross</dc:creator>
    <dc:date>2022-11-23T22:01:26Z</dc:date>
    <item>
      <title>Challenge #1 Employees transition between departments using the Sankey chart</title>
      <link>https://community.incorta.com/t5/incorta-conundrums/challenge-1-employees-transition-between-departments-using-the/m-p/3312#M4</link>
      <description>&lt;P&gt;&lt;SPAN&gt;In an organization for software development, some employees make a decision to move to another department to gain more experience and help in the implementation and improvement processes,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;As an end user, I need to track and have a complete picture of the flow between the organization’s departments&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Can you help me get this data insight?? &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I would like to see a Sankey chart showing the movement of the employees between departments in an organization based on the employees' count I believe it should be something like this:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Rasha_0-1668787218023.png" style="width: 999px;"&gt;&lt;img src="https://community.incorta.com/t5/image/serverpage/image-id/1739iEBCDE52C60FC825F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Rasha_0-1668787218023.png" alt="Rasha_0-1668787218023.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can use the below-attached data sets files:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1-employees.csv&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2-department.csv&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;3-dept_emp.csv&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Also, you can check this article as an example for the Sankey chart&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.incorta.com/5.2/references-visualizations-sankey#sankey-insight-example" target="_blank"&gt;&lt;SPAN&gt;https://docs.incorta.com/5.2/references-visualizations-sankey#sankey-insight-example&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Please try it, and attach here the outputs(schema and the dashboard) I Hope you enjoy it &lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2022 16:06:38 GMT</pubDate>
      <guid>https://community.incorta.com/t5/incorta-conundrums/challenge-1-employees-transition-between-departments-using-the/m-p/3312#M4</guid>
      <dc:creator>Rasha</dc:creator>
      <dc:date>2022-11-18T16:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: Challenge #1 Employees transition between departments using the Sankey chart</title>
      <link>https://community.incorta.com/t5/incorta-conundrums/challenge-1-employees-transition-between-departments-using-the/m-p/3335#M5</link>
      <description>&lt;P&gt;Here is my output.&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Employee Transitions Between departments - CommunityChallenge1.png" style="width: 400px;"&gt;&lt;img src="https://community.incorta.com/t5/image/serverpage/image-id/1742i69CE2043D9F0FC3E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Employee Transitions Between departments - CommunityChallenge1.png" alt="Employee Transitions Between departments - CommunityChallenge1.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Upload the CSV files, create a schema and create a table from each one.&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="marwansalem_0-1669141475930.png" style="width: 400px;"&gt;&lt;img src="https://community.incorta.com/t5/image/serverpage/image-id/1743i61D4E8AA58642C70/image-size/medium?v=v2&amp;amp;px=400" role="button" title="marwansalem_0-1669141475930.png" alt="marwansalem_0-1669141475930.png" /&gt;&lt;/span&gt;&lt;/LI&gt;
&lt;LI&gt;Create Materialized View (MV) that generates all the employee transitions.&lt;/LI&gt;
&lt;LI&gt;Create another table that shows the total number of employees that moved from one department to another (EmployeeTransitionSummary)&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="marwansalem_1-1669142033050.png" style="width: 400px;"&gt;&lt;img src="https://community.incorta.com/t5/image/serverpage/image-id/1744i4698BCF57C5E6474/image-size/medium?v=v2&amp;amp;px=400" role="button" title="marwansalem_1-1669142033050.png" alt="marwansalem_1-1669142033050.png" /&gt;&lt;/span&gt;&lt;/LI&gt;
&lt;LI&gt;Create a new insight, and use &lt;I&gt;Dept Name&lt;/I&gt; as the &lt;STRONG&gt;source&lt;/STRONG&gt;, New Dept Name as the &lt;STRONG&gt;target, and &lt;EM&gt;Employee Count&lt;/EM&gt; as the measure. &lt;/STRONG&gt;&lt;STRONG&gt;Optionally sort the source field by &lt;EM&gt;Employee Count. (&lt;/EM&gt;We can also  use &lt;EM&gt;Insight over Insight&lt;/EM&gt; instead of creating a separate table for &lt;/STRONG&gt;EmployeeTransitionSummary&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="marwansalem_0-1669142207352.png" style="width: 400px;"&gt;&lt;img src="https://community.incorta.com/t5/image/serverpage/image-id/1747iED1A495A42E7E700/image-size/medium?v=v2&amp;amp;px=400" role="button" title="marwansalem_0-1669142207352.png" alt="marwansalem_0-1669142207352.png" /&gt;&lt;/span&gt;
&lt;P&gt; &lt;/P&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Now for the Materialized View in step#2, here is the PySpark script for EmployeeTransitions.&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;LI-CODE lang="python"&gt;from pyspark.sql.window import Window
from pyspark.sql.functions import lead
dept = read('CommunityChallenge1.department')
dept_emp = read('CommunityChallenge1.dept_emp').withColumnRenamed('dept_no', 'employee_dept_no')

# join with department table to include department name
dept_emp = dept_emp.join(dept, dept.dept_no == dept_emp.employee_dept_no).drop('employee_dept_no')

# partition by the employee number and order by start date "from_date"
windowSpec  = Window.partitionBy("emp_no").orderBy("from_date")

# use lead function to get the "next" department name
transitions = dept_emp.withColumn('new_dept_name', lead("dept_name", 1).over(windowSpec))
transitions = transitions.filter(transitions.new_dept_name.isNotNull()).sort('emp_no')
save(transitions)&lt;/LI-CODE&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P&gt;You can learn more about windows functions in PySpark &lt;A href="https://sparkbyexamples.com/pyspark/pyspark-window-functions/" target="_blank" rel="noopener"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2022 10:58:54 GMT</pubDate>
      <guid>https://community.incorta.com/t5/incorta-conundrums/challenge-1-employees-transition-between-departments-using-the/m-p/3335#M5</guid>
      <dc:creator>marwansalem</dc:creator>
      <dc:date>2022-11-23T10:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: Challenge #1 Employees transition between departments using the Sankey chart</title>
      <link>https://community.incorta.com/t5/incorta-conundrums/challenge-1-employees-transition-between-departments-using-the/m-p/3348#M6</link>
      <description>&lt;P&gt;I am solving this challenge using the power of Incorta's no-code/low-code capabilities. &lt;/P&gt;
&lt;P&gt;1.) Upload the CSV files, create a schema and create tables for the department.csv and dept_emp.csv files. &lt;/P&gt;
&lt;P&gt;2.) Create aliases of department and dept_emp.&lt;/P&gt;
&lt;P&gt;3.) Join dept_emp to the department on the dept_no. Join dept_emp to its alias with the below joins. Join the dept_emp alias to the department alias on dept_no. &lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2022-11-23 at 4.39.49 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.incorta.com/t5/image/serverpage/image-id/1750iD0FA1C5100E1CE2A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2022-11-23 at 4.39.49 PM.png" alt="Screen Shot 2022-11-23 at 4.39.49 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;4.) Add a Formula Columns to the dept_emp table with the Column Formula of 1. We are creating this because at this time, the Sankey only supports sums and not counts. &lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2022-11-23 at 4.43.14 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.incorta.com/t5/image/serverpage/image-id/1751i0F5366E6E0135148/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2022-11-23 at 4.43.14 PM.png" alt="Screen Shot 2022-11-23 at 4.43.14 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;5.) Create an Aggregate Table insight. Put the Dept Name from the department table in the Grouping Dimension. Put the Dept Name from the department alias table in the Grouping Dimension below the other Dept Name, I recommend renaming it not to confuse the two. The formula column you created should be in the measure. To filter only on transfers, grab any column from the dept_emp alias table, place it in the Individual Filter, and only show Not Null records. &lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2022-11-23 at 4.44.54 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.incorta.com/t5/image/serverpage/image-id/1752iCC0E1052B52E7357/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2022-11-23 at 4.44.54 PM.png" alt="Screen Shot 2022-11-23 at 4.44.54 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;6.) Change the Insight into a Sankey and add the formula column you created as the Sort By of the Dept Name in the Source. &lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2022-11-23 at 4.51.23 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.incorta.com/t5/image/serverpage/image-id/1753iAA10FC308286A3BA/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2022-11-23 at 4.51.23 PM.png" alt="Screen Shot 2022-11-23 at 4.51.23 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt; Here is the diagram of my Sankey schema for this challenge. &lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2022-11-23 at 4.38.33 PM.png" style="width: 400px;"&gt;&lt;img src="https://community.incorta.com/t5/image/serverpage/image-id/1754i5628D50C0640B749/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screen Shot 2022-11-23 at 4.38.33 PM.png" alt="Screen Shot 2022-11-23 at 4.38.33 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The join between the dept_emp and alias of dept_emp only works because the to date from the previous department matches the from date of the new department. If this was different we would have to create a different solution using Incortas &lt;A href="https://docs.incorta.com/5.1/concepts-join-filter" target="_self"&gt;First Version filter&lt;/A&gt; or SQL/Pyspark. &lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2022-11-23 at 5.00.42 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.incorta.com/t5/image/serverpage/image-id/1756i65D09483148CF314/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2022-11-23 at 5.00.42 PM.png" alt="Screen Shot 2022-11-23 at 5.00.42 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2022 22:01:26 GMT</pubDate>
      <guid>https://community.incorta.com/t5/incorta-conundrums/challenge-1-employees-transition-between-departments-using-the/m-p/3348#M6</guid>
      <dc:creator>john_cross</dc:creator>
      <dc:date>2022-11-23T22:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: Challenge #1 Employees transition between departments using the Sankey chart</title>
      <link>https://community.incorta.com/t5/incorta-conundrums/challenge-1-employees-transition-between-departments-using-the/m-p/3668#M11</link>
      <description>&lt;P&gt;Here is a video demonstration of the solution&amp;nbsp;&lt;a href="https://community.incorta.com/t5/user/viewprofilepage/user-id/273"&gt;@john_cross&lt;/a&gt;&amp;nbsp;provided above. Hope this is helpful!&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.youtube.com/watch?v=uTfXWgtvJE8" target="_blank"&gt;https://www.youtube.com/watch?v=uTfXWgtvJE8&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jan 2023 02:33:39 GMT</pubDate>
      <guid>https://community.incorta.com/t5/incorta-conundrums/challenge-1-employees-transition-between-departments-using-the/m-p/3668#M11</guid>
      <dc:creator>LukeG</dc:creator>
      <dc:date>2023-01-27T02:33:39Z</dc:date>
    </item>
    <item>
      <title>Re: Challenge #1 Employees transition between departments using the Sankey chart</title>
      <link>https://community.incorta.com/t5/incorta-conundrums/challenge-1-employees-transition-between-departments-using-the/m-p/3674#M12</link>
      <description>&lt;P&gt;Awesome video! Thanks&amp;nbsp;&lt;a href="https://community.incorta.com/t5/user/viewprofilepage/user-id/244"&gt;@LukeG&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jan 2023 15:47:06 GMT</pubDate>
      <guid>https://community.incorta.com/t5/incorta-conundrums/challenge-1-employees-transition-between-departments-using-the/m-p/3674#M12</guid>
      <dc:creator>JoeM</dc:creator>
      <dc:date>2023-01-27T15:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: Challenge #1 Employees transition between departments using the Sankey chart</title>
      <link>https://community.incorta.com/t5/incorta-conundrums/challenge-1-employees-transition-between-departments-using-the/m-p/3944#M24</link>
      <description>&lt;P&gt;&lt;SPAN&gt;We can also write SQL queries to generate the transitions in Incorta.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My results:&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Challenge #1 Employee Transitions Between Departments.png" style="width: 999px;"&gt;&lt;img src="https://community.incorta.com/t5/image/serverpage/image-id/2034i4638D5D9C3A534B8/image-size/large?v=v2&amp;amp;px=999" role="button" title="Challenge #1 Employee Transitions Between Departments.png" alt="Challenge #1 Employee Transitions Between Departments.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;Steps: &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;upload all files, create schema and add all three tables to the schema&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;add Incorta SQL Table and create table with tree columns (&lt;STRONG&gt;dept_name&lt;/STRONG&gt;, &lt;STRONG&gt;new_dept_name&lt;/STRONG&gt;, &lt;STRONG&gt;emp_no_count&lt;/STRONG&gt;) by writing SQL query.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="2"&gt;build insight on top of the generated Incorta SQL table, choose insight type as Sankey, drag &lt;STRONG&gt;dept&lt;/STRONG&gt; to SOURCE, &lt;STRONG&gt;new_dept_name&lt;/STRONG&gt; to TARGET, and &lt;STRONG&gt;emp_no_count&lt;/STRONG&gt;&amp;nbsp;&lt;SPAN&gt;to MEASURE.&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;FONT size="2"&gt;Query for step 2:&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;With dept_emp_comb as (
				SELECT
					dept_emp.emp_no,
					dept_emp.dept_no,
					dept_emp.from_date,
					dept_emp.to_date,
					dept.dept_name
				from
					sch_CommunityChallenge1.dept_emp as dept_emp
					inner join sch_CommunityChallenge1.department as dept on dept_emp.dept_no = dept.dept_no
),
transitions as (
				SELECT
					table1.dept_name as dept_name,
					table1.emp_no as emp_no,
					table2.dept_name as new_dept_name
				from
					dept_emp_comb as table1
					inner join dept_emp_comb as table2 on table1.emp_no = table2.emp_no
					and table1.from_date &amp;lt; table2.from_date
)
SELECT
	dept_name,
	new_dept_name,
	COUNT(emp_no) as emp_no_count
FROM
	transitions
GROUP BY
	dept_name,
	new_dept_name
ORDER BY
	dept_name;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 19:45:05 GMT</pubDate>
      <guid>https://community.incorta.com/t5/incorta-conundrums/challenge-1-employees-transition-between-departments-using-the/m-p/3944#M24</guid>
      <dc:creator>zhong</dc:creator>
      <dc:date>2023-03-23T19:45:05Z</dc:date>
    </item>
  </channel>
</rss>

