<?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: Help me to restrict the data at dataflow level  like using case statement in SQL in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Help-me-to-restrict-the-data-at-dataflow-level-like-using-case/m-p/3399181#M44096</link>
    <description>&lt;P&gt;Thanks a lot Martin, its working as expected.&lt;/P&gt;</description>
    <pubDate>Fri, 25 Aug 2023 13:21:35 GMT</pubDate>
    <dc:creator>JVKR</dc:creator>
    <dc:date>2023-08-25T13:21:35Z</dc:date>
    <item>
      <title>Help me to restrict the data at dataflow level  like using case statement in SQL</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Help-me-to-restrict-the-data-at-dataflow-level-like-using-case/m-p/3397399#M44065</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JVKR_0-1692980837936.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/960584i880C18BE616D199A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JVKR_0-1692980837936.png" alt="JVKR_0-1692980837936.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Aug 2023 16:28:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Help-me-to-restrict-the-data-at-dataflow-level-like-using-case/m-p/3397399#M44065</guid>
      <dc:creator>JVKR</dc:creator>
      <dc:date>2023-08-25T16:28:13Z</dc:date>
    </item>
    <item>
      <title>Re: Help me to restrict the data at dataflow level  like using case statement in SQL</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Help-me-to-restrict-the-data-at-dataflow-level-like-using-case/m-p/3397803#M44069</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/568017"&gt;@JVKR&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Are you sure the example is correct and the requirements are correct? The highlighted row does not meet the criterion "when NewValue="closed"". NewValue is "2" in your example.&lt;BR /&gt;BR&lt;BR /&gt;Martin&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2023 20:29:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Help-me-to-restrict-the-data-at-dataflow-level-like-using-case/m-p/3397803#M44069</guid>
      <dc:creator>Martin_D</dc:creator>
      <dc:date>2023-08-24T20:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: Help me to restrict the data at dataflow level  like using case statement in SQL</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Help-me-to-restrict-the-data-at-dataflow-level-like-using-case/m-p/3397829#M44071</link>
      <description>&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my requirement is , i dont want to fetch any records from the source table once the lead is closed.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example : l&lt;/STRONG&gt;ead is closed on 20th July 2024 but the lead is updated again on 24th July 2023 which i dont need to pull from the source table.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2023 20:35:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Help-me-to-restrict-the-data-at-dataflow-level-like-using-case/m-p/3397829#M44071</guid>
      <dc:creator>JVKR</dc:creator>
      <dc:date>2023-08-24T20:35:25Z</dc:date>
    </item>
    <item>
      <title>Re: Help me to restrict the data at dataflow level  like using case statement in SQL</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Help-me-to-restrict-the-data-at-dataflow-level-like-using-case/m-p/3397897#M44072</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/568017"&gt;@JVKR&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;Now I got it. When sorting by the CreatedDate column it becomes quickly obvious that for each lead that already has a "Closed" event you just want to remove all events after the closed event.&lt;/P&gt;&lt;P&gt;You can do this in PowerQuery with these steps:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Add a custom column that for each lead contains the Closed date of the lead (or null if the lead is not yet closed) so you can compare CreatedDate against the lead closed date in a filter.&lt;/LI&gt;&lt;LI&gt;Filter the rows and remove all rows with a CreatedDate after the lead closed date (resp. keep all rows with CreatedDate before or at lead closed date).&lt;/LI&gt;&lt;LI&gt;If you need to clean up additional columns, remove the lead closed column again.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Assuming the name of your currently last step in your PowerQuery transformations is "Previous step", then the code you need to add is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    #"Add column closed date" = Table.AddColumn(
        #"Previous step",
        "ClosedDate",
        (outer) =&amp;gt;
            List.Min(
                Table.SelectRows(
                    #"Previous step",
                    (inner) =&amp;gt; 
                        inner[LeadId] = outer[LeadId] and inner[NewValue] = "Closed"
                )[CreatedDate]
            ),
        type datetime
    ),

    // Be aware that the logic in the code describes which rows to keep, 
    // not which rows to remove.
    #"Filtered rows" = Table.SelectRows(
        #"Add column closed date", 
        each [CreatedDate] &amp;lt;= [ClosedDate] or [ClosedDate] = null
    ),

    #"Remove column closed date" = Table.RemoveColumns(
        #"Filtered rows",
        {"ClosedDate"}
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then change the return statement according to the name of the new last step:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;in
    #"Remove column closed date"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and make sure a comma is added to the end of the previously last step (here called "Previous step").&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Martin&lt;/P&gt;&lt;P class="lia-align-right"&gt;&lt;A title="GitHub" href="https://github.com/MartinBubenheimer" target="_blank" rel="noopener"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-right" image-alt="github.png" style="width: 34px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/933704i8348AD2A9C7A3ED4/image-dimensions/34x34?v=v2" width="34" height="34" role="button" title="github.png" alt="github.png" /&gt;&lt;/span&gt;&lt;/A&gt;&lt;A title="linkedin" href="https://www.linkedin.com/in/martin-bubenheimer-9ba99271/" target="_blank" rel="noopener"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-right" image-alt="linkedin.png" style="width: 36px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/933703i7ADBF83A4A253887/image-dimensions/36x31?v=v2" width="36" height="31" role="button" title="linkedin.png" alt="linkedin.png" /&gt;&lt;/span&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2023 21:46:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Help-me-to-restrict-the-data-at-dataflow-level-like-using-case/m-p/3397897#M44072</guid>
      <dc:creator>Martin_D</dc:creator>
      <dc:date>2023-08-24T21:46:46Z</dc:date>
    </item>
    <item>
      <title>Re: Help me to restrict the data at dataflow level  like using case statement in SQL</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Help-me-to-restrict-the-data-at-dataflow-level-like-using-case/m-p/3397912#M44073</link>
      <description>&lt;P&gt;Sorry, the LeadId was hardcoded in my original post. I fixed it in the previous message.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2023 21:47:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Help-me-to-restrict-the-data-at-dataflow-level-like-using-case/m-p/3397912#M44073</guid>
      <dc:creator>Martin_D</dc:creator>
      <dc:date>2023-08-24T21:47:31Z</dc:date>
    </item>
    <item>
      <title>Re: Help me to restrict the data at dataflow level  like using case statement in SQL</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Help-me-to-restrict-the-data-at-dataflow-level-like-using-case/m-p/3399181#M44096</link>
      <description>&lt;P&gt;Thanks a lot Martin, its working as expected.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Aug 2023 13:21:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Help-me-to-restrict-the-data-at-dataflow-level-like-using-case/m-p/3399181#M44096</guid>
      <dc:creator>JVKR</dc:creator>
      <dc:date>2023-08-25T13:21:35Z</dc:date>
    </item>
  </channel>
</rss>

