<?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: Combining data based on additional keys in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Combining-data-based-on-additional-keys/m-p/3090306#M108227</link>
    <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="360305" data-lia-user-login="rmorris" class="lia-mention lia-mention-user"&gt;rmorris&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;We have created two sample tables “Sample Table 1” and “Sample Table 2” as you explained your requirement and you want a combined table where comments need to be displayed as comma separated data based on Unique Sales ID.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Please refer to the below screenshot for sample data.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Now we need to create a Merged table, so Navigate to Edit Query and click on Merge Queries as New option as shown in the below screenshot.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;This will create a Merged Table automatically, now close the Query editor and create a Column in the Merged Table with below DAX expression:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Comments = CONCATENATEX(FILTER('Sample Table 2', 'Sample Table 2'[SalesID] = Merge1[SalesID]), 'Sample Table 2'[Comment], ",")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please refer to the below screenshot for Comments DAX and Output for the same.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;If this answer helps, please mark it as Accepted Solution so it would help others to find the solution.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks!&lt;/P&gt;&lt;P&gt;Inogic Professional Service Division&lt;/P&gt;&lt;P&gt;An expert technical extension for your techno-functional business needs&lt;/P&gt;&lt;P&gt;Power Platform/Dynamics 365 CRM&lt;/P&gt;&lt;P&gt;Drop an email at &lt;A href="mailto:crm@inogic.com" target="_blank"&gt;crm@inogic.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Service:&amp;nbsp; &lt;A href="http://www.inogic.com/services/" target="_blank"&gt;http://www.inogic.com/services/&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Power Platform/Dynamics 365 CRM Tips and Tricks:&amp;nbsp; &lt;A href="http://www.inogic.com/blog/" target="_blank"&gt;http://www.inogic.com/blog/&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 21 Feb 2023 12:22:12 GMT</pubDate>
    <dc:creator>SamInogic</dc:creator>
    <dc:date>2023-02-21T12:22:12Z</dc:date>
    <item>
      <title>Combining data based on additional keys</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Combining-data-based-on-additional-keys/m-p/3089259#M108134</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm working with a SQL database that i only have read only access to. I've got two data table that i've imported to PowerBI that i need combine based the SalesID and the CommentID, but each SalesID can have either zero to 10+ CommentID's each. I'm trying to combine the text in the comment field into one cell.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table 1&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;SalesID&lt;/TD&gt;&lt;TD&gt;Value&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;M255487&lt;/TD&gt;&lt;TD&gt;$500.00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;M255488&lt;/TD&gt;&lt;TD&gt;$650.00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;M255489&lt;/TD&gt;&lt;TD&gt;$150.00&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table 2&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;SalesID&lt;/TD&gt;&lt;TD&gt;CommentID&lt;/TD&gt;&lt;TD&gt;Comment&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;M255487&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;15/07 spoke to Kevin about order&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;M255487&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;Emailed Quote&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;M255487&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;Rang and spoke to Peter&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;M255488&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Cash Sale&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What i'm trying to achieve as the end result, where it will combine the comments into one field&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;SalesID&lt;/TD&gt;&lt;TD&gt;Value&lt;/TD&gt;&lt;TD&gt;Comment&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;M255487&lt;/TD&gt;&lt;TD&gt;$500.00&lt;/TD&gt;&lt;TD&gt;15/07 spoke to Kevin about order,&amp;nbsp;Emailed Quote,&amp;nbsp;Rang and spoke to Peter&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;M255488&lt;/TD&gt;&lt;TD&gt;$650.00&lt;/TD&gt;&lt;TD&gt;Cash Sale&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;M255489&lt;/TD&gt;&lt;TD&gt;$150.00&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2023 02:55:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Combining-data-based-on-additional-keys/m-p/3089259#M108134</guid>
      <dc:creator>rmorris</dc:creator>
      <dc:date>2023-02-21T02:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: Combining data based on additional keys</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Combining-data-based-on-additional-keys/m-p/3090306#M108227</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="360305" data-lia-user-login="rmorris" class="lia-mention lia-mention-user"&gt;rmorris&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;We have created two sample tables “Sample Table 1” and “Sample Table 2” as you explained your requirement and you want a combined table where comments need to be displayed as comma separated data based on Unique Sales ID.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Please refer to the below screenshot for sample data.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Now we need to create a Merged table, so Navigate to Edit Query and click on Merge Queries as New option as shown in the below screenshot.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;This will create a Merged Table automatically, now close the Query editor and create a Column in the Merged Table with below DAX expression:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Comments = CONCATENATEX(FILTER('Sample Table 2', 'Sample Table 2'[SalesID] = Merge1[SalesID]), 'Sample Table 2'[Comment], ",")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please refer to the below screenshot for Comments DAX and Output for the same.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;If this answer helps, please mark it as Accepted Solution so it would help others to find the solution.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks!&lt;/P&gt;&lt;P&gt;Inogic Professional Service Division&lt;/P&gt;&lt;P&gt;An expert technical extension for your techno-functional business needs&lt;/P&gt;&lt;P&gt;Power Platform/Dynamics 365 CRM&lt;/P&gt;&lt;P&gt;Drop an email at &lt;A href="mailto:crm@inogic.com" target="_blank"&gt;crm@inogic.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Service:&amp;nbsp; &lt;A href="http://www.inogic.com/services/" target="_blank"&gt;http://www.inogic.com/services/&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Power Platform/Dynamics 365 CRM Tips and Tricks:&amp;nbsp; &lt;A href="http://www.inogic.com/blog/" target="_blank"&gt;http://www.inogic.com/blog/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2023 12:22:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Combining-data-based-on-additional-keys/m-p/3090306#M108227</guid>
      <dc:creator>SamInogic</dc:creator>
      <dc:date>2023-02-21T12:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: Combining data based on additional keys</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Combining-data-based-on-additional-keys/m-p/3090791#M108266</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="360305" data-lia-user-login="rmorris" class="lia-mention lia-mention-user"&gt;rmorris&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try to add a calculated column in table1 like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Comment = 
VAR _sales = [SalesID]
RETURN
CONCATENATEX(
    CALCULATETABLE(
        VALUES(Table2[Comment]),
        Table2[SalesID] = _sales
    ),
    Table2[Comment],", "
)&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, 21 Feb 2023 15:57:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Combining-data-based-on-additional-keys/m-p/3090791#M108266</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2023-02-21T15:57:41Z</dc:date>
    </item>
  </channel>
</rss>

