<?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: New table with filtered distinct ID's in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-table-with-filtered-distinct-ID-s/m-p/1838574#M39200</link>
    <description>&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Hi Thomvdw,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;New Table = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR _MaxPeriod = MAX('Table'[Period])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATETABLE(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SUMMARIZE('Table', 'Table'[Period], 'Table'[ContractID]),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'Table'[Period ] = _MaxPeriod&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Wed, 12 May 2021 12:44:21 GMT</pubDate>
    <dc:creator>PaulOlding</dc:creator>
    <dc:date>2021-05-12T12:44:21Z</dc:date>
    <item>
      <title>New table with filtered distinct ID's</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-table-with-filtered-distinct-ID-s/m-p/1838337#M39183</link>
      <description>&lt;P&gt;Hi Community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a datatable with multiple months below each other. The datatable consists of the column 'period' and 'ContractID'.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The goal is to create a new table with only the distinct ContractID's from the last available month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried multiple variations of lines of code, but none gave me the right answer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully somebody here can help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks, Thom&lt;/P&gt;</description>
      <pubDate>Wed, 12 May 2021 10:26:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-table-with-filtered-distinct-ID-s/m-p/1838337#M39183</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-05-12T10:26:26Z</dc:date>
    </item>
    <item>
      <title>Re: New table with filtered distinct ID's</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-table-with-filtered-distinct-ID-s/m-p/1838468#M39189</link>
      <description>&lt;P&gt;1. Sample, representative data for the problem.&lt;/P&gt;&lt;P&gt;2. Transformation description.&lt;/P&gt;&lt;P&gt;3. Desired outcome.&lt;/P&gt;</description>
      <pubDate>Wed, 12 May 2021 11:53:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-table-with-filtered-distinct-ID-s/m-p/1838468#M39189</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-05-12T11:53:30Z</dc:date>
    </item>
    <item>
      <title>Re: New table with filtered distinct ID's</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-table-with-filtered-distinct-ID-s/m-p/1838497#M39193</link>
      <description>&lt;P&gt;Hi Daxer,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample datatable is:&lt;/P&gt;&lt;P&gt;Period ContractID&lt;BR /&gt;2021-01 1&lt;BR /&gt;2021-01 2&lt;BR /&gt;2021-01 3&lt;BR /&gt;2021-01 3&lt;BR /&gt;2021-02 2&lt;BR /&gt;2021-02 3&lt;BR /&gt;2021-02 3&lt;BR /&gt;2021-02 4&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;In this sample the last month is 2021-02, so I expect the new datatable outcome to be:&lt;/P&gt;&lt;P&gt;Period ContractID&lt;BR /&gt;2021-02 2&lt;BR /&gt;2021-02 3&lt;BR /&gt;2021-02 4&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Hope this clarifies&lt;/P&gt;</description>
      <pubDate>Wed, 12 May 2021 12:10:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-table-with-filtered-distinct-ID-s/m-p/1838497#M39193</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-05-12T12:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: New table with filtered distinct ID's</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-table-with-filtered-distinct-ID-s/m-p/1838571#M39198</link>
      <description>&lt;LI-CODE lang="csharp"&gt;// Data
let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtQ1MFQwVIrVQfCMUHjGOHlGKCqN0ORQeSZKsbEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Period ContractID" = _t]),
    #"Split Column by Delimiter" = Table.SplitColumn(Source, "Period ContractID", Splitter.SplitTextByEachDelimiter({" "}, QuoteStyle.Csv, false), {"Period ContractID.1", "Period ContractID.2"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Period ContractID.1", type date}, {"Period ContractID.2", Int64.Type}}),
    #"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Period ContractID.1", "Period"}, {"Period ContractID.2", "ContractID"}}),
    #"Removed Duplicates" = Table.Distinct(#"Renamed Columns"),
    #"Calculate Max Date" = List.Max(#"Removed Duplicates"[Period], null),
    #"Should Keep" = Table.AddColumn(
        #"Removed Duplicates", "Should Keep?",
        each [Period] = #"Calculate Max Date"
    ),
    #"Filtered Rows" = Table.SelectRows(#"Should Keep", each ([#"Should Keep?"] = true)),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Should Keep?"})
in
    #"Removed Columns"&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 12 May 2021 12:43:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-table-with-filtered-distinct-ID-s/m-p/1838571#M39198</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-05-12T12:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: New table with filtered distinct ID's</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-table-with-filtered-distinct-ID-s/m-p/1838574#M39200</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Hi Thomvdw,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;New Table = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR _MaxPeriod = MAX('Table'[Period])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATETABLE(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SUMMARIZE('Table', 'Table'[Period], 'Table'[ContractID]),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'Table'[Period ] = _MaxPeriod&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 12 May 2021 12:44:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-table-with-filtered-distinct-ID-s/m-p/1838574#M39200</guid>
      <dc:creator>PaulOlding</dc:creator>
      <dc:date>2021-05-12T12:44:21Z</dc:date>
    </item>
  </channel>
</rss>

