<?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 Dax function to concatenate records from multiple rows in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-function-to-concatenate-records-from-multiple-rows/m-p/3504208#M134483</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can someone help please with the following!&lt;/P&gt;&lt;P&gt;I have the first 2 columns generated from a datasource, im trying to create a DAX function to create the last 3 columns. Basically for each product there can be one more colors, so 3rd column should concatenate the colors for the same (unique) products, then 4th coloum to flag the last record for each product and last column to display the count of colors in the concatenated column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 30 Oct 2023 09:37:00 GMT</pubDate>
    <dc:creator>hassanh2</dc:creator>
    <dc:date>2023-10-30T09:37:00Z</dc:date>
    <item>
      <title>Dax function to concatenate records from multiple rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-function-to-concatenate-records-from-multiple-rows/m-p/3504208#M134483</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can someone help please with the following!&lt;/P&gt;&lt;P&gt;I have the first 2 columns generated from a datasource, im trying to create a DAX function to create the last 3 columns. Basically for each product there can be one more colors, so 3rd column should concatenate the colors for the same (unique) products, then 4th coloum to flag the last record for each product and last column to display the count of colors in the concatenated column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2023 09:37:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-function-to-concatenate-records-from-multiple-rows/m-p/3504208#M134483</guid>
      <dc:creator>hassanh2</dc:creator>
      <dc:date>2023-10-30T09:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: Dax function to concatenate records from multiple rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-function-to-concatenate-records-from-multiple-rows/m-p/3505996#M134492</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="413539" data-lia-user-login="hassanh2" class="lia-mention lia-mention-user"&gt;hassanh2&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;try like:&lt;/P&gt;
&lt;P&gt;1) add an index column in Power Query or datasource&lt;/P&gt;
&lt;P&gt;2) add the expected calculated columns like:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ColorCon = 
CONCATENATEX(
    CALCULATETABLE(
        DISTINCT(data[Color]),
        ALLEXCEPT(data, data[Product]),
        data[Index]&amp;lt;=EARLIER(data[Index])
    ),
    data[Color],
    "^"
)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Flag = 
VAR _max =
MAXX(
    FILTER(data, 
        data[Product]=EARLIER(data[Product])
    ),
    data[index]
)
VAR result = IF(data[index]=_max, "Last")
RETURN result&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;ColorCount = 
CALCULATE(
    DISTINCTCOUNT(data[Color]),
    ALLEXCEPT(data, data[Product]),
    data[Index]&amp;lt;=EARLIER(data[Index])
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it worked like:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2023 02:14:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-function-to-concatenate-records-from-multiple-rows/m-p/3505996#M134492</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2023-10-31T02:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: Dax function to concatenate records from multiple rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-function-to-concatenate-records-from-multiple-rows/m-p/3511732#M134769</link>
      <description>&lt;P&gt;Thank you very much. This is very helpful.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2023 10:40:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-function-to-concatenate-records-from-multiple-rows/m-p/3511732#M134769</guid>
      <dc:creator>hassanh2</dc:creator>
      <dc:date>2023-11-02T10:40:53Z</dc:date>
    </item>
  </channel>
</rss>

