<?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: Merge rows on single id in Direct Query in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Merge-rows-on-single-id-in-Direct-Query/m-p/4092346#M162401</link>
    <description>&lt;P&gt;Use a table visual&lt;/P&gt;
&lt;P&gt;Add the case id&lt;/P&gt;
&lt;P&gt;Add the Created column twice&lt;/P&gt;
&lt;P&gt;Set the first to Min and the second to Max&lt;/P&gt;</description>
    <pubDate>Fri, 09 Aug 2024 17:12:02 GMT</pubDate>
    <dc:creator>lbendlin</dc:creator>
    <dc:date>2024-08-09T17:12:02Z</dc:date>
    <item>
      <title>Merge rows on single id in Direct Query</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Merge-rows-on-single-id-in-Direct-Query/m-p/4091968#M162390</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The background&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I'm trying to build a performance management dashboard for a multi-stage customer complaints process.&amp;nbsp; The data comes from a case management/CRM system and is shared by a third party supplier through direct query.&amp;nbsp; Unfortunately I can't share any of the actual data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The story so far&lt;BR /&gt;&lt;/STRONG&gt;I'm trying to use data from the Case_Audit table to track how long things are in a queue waiting to picked up.&amp;nbsp; I've filtered the data in Power BI by history type 'Case re-assigned' and&amp;nbsp;by contains 'Allocation Queue'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what the data looked like:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;CaseId&lt;/TD&gt;&lt;TD&gt;Created&lt;/TD&gt;&lt;TD&gt;History type&lt;/TD&gt;&lt;TD&gt;Description&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0001&lt;/TD&gt;&lt;TD&gt;01/08/24&lt;/TD&gt;&lt;TD&gt;Case re-assigned&lt;/TD&gt;&lt;TD&gt;Assigned from John Smith to Allocation Queue&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0001&lt;/TD&gt;&lt;TD&gt;04/08/24&lt;/TD&gt;&lt;TD&gt;Case re-assigned&lt;/TD&gt;&lt;TD&gt;Assigned from Allocation Queue to Linda Brown&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0002&lt;/TD&gt;&lt;TD&gt;02/08/24&lt;/TD&gt;&lt;TD&gt;Case re-assigned&lt;/TD&gt;&lt;TD&gt;Assigned from Mary O'Brien to Allocation Queue&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0002&lt;/TD&gt;&lt;TD&gt;04/08/24&lt;/TD&gt;&lt;TD&gt;Case re-assigned&lt;/TD&gt;&lt;TD&gt;Assigned from Allocation Queue to John McPhee&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;What I've done so far&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I created the following DAX calculated columns:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Allocation direction = IF(CONTAINSSTRING('Case_Audit'[Description],"to Allocation Queue"),"To","From")&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Allocated date = IF(Case_Audit[Allocation direction]="To",'Case_Audit'[Created],BLANK())&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Re-allocated date = IF(Case_Audit[Allocation direction]="From",'Case_Audit'[Created],BLANK())&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And the following DAX measures:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Allocated date measure = MAX('Case_Audit'[Allocated date])&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Re-allocated measure = MAX('Case_Audit'[Re-allocated date])&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Allocation days = DATEDIFF('Case_Audit'[Allocated date measure],'Case_Audit'[Re-allocated measure],DAY)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;This is how my table looks at the moment:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;CaseId&lt;/TD&gt;&lt;TD&gt;Created&lt;/TD&gt;&lt;TD&gt;Allocated date measure&lt;/TD&gt;&lt;TD&gt;Re-allocated measure&lt;/TD&gt;&lt;TD&gt;Allocation days&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0001&lt;/TD&gt;&lt;TD&gt;01/08/24&lt;/TD&gt;&lt;TD&gt;01/08/24&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0001&lt;/TD&gt;&lt;TD&gt;04/08/24&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;04/08/24&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0002&lt;/TD&gt;&lt;TD&gt;02/08/24&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;02/08/24&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0002&lt;/TD&gt;&lt;TD&gt;04/08/24&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;04/08/24&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The problem&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I need to find a method that works in Direct Query and doesn't use Power Query to collapse the data so that it looks like this:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;CaseId&lt;/TD&gt;&lt;TD&gt;Created&lt;/TD&gt;&lt;TD&gt;Allocated date measure&lt;/TD&gt;&lt;TD&gt;Re-allocated measure&lt;/TD&gt;&lt;TD&gt;Allocation days&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0001&lt;/TD&gt;&lt;TD&gt;01/08/24&lt;/TD&gt;&lt;TD&gt;01/08/24&lt;/TD&gt;&lt;TD&gt;04/08/24&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0002&lt;/TD&gt;&lt;TD&gt;02/08/24&lt;/TD&gt;&lt;TD&gt;02/08/24&lt;/TD&gt;&lt;TD&gt;04/08/24&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2024 14:19:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Merge-rows-on-single-id-in-Direct-Query/m-p/4091968#M162390</guid>
      <dc:creator>MJDS</dc:creator>
      <dc:date>2024-08-09T14:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: Merge rows on single id in Direct Query</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Merge-rows-on-single-id-in-Direct-Query/m-p/4092346#M162401</link>
      <description>&lt;P&gt;Use a table visual&lt;/P&gt;
&lt;P&gt;Add the case id&lt;/P&gt;
&lt;P&gt;Add the Created column twice&lt;/P&gt;
&lt;P&gt;Set the first to Min and the second to Max&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2024 17:12:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Merge-rows-on-single-id-in-Direct-Query/m-p/4092346#M162401</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-08-09T17:12:02Z</dc:date>
    </item>
    <item>
      <title>Re: Merge rows on single id in Direct Query</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Merge-rows-on-single-id-in-Direct-Query/m-p/4095038#M162512</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thanks, is there a way I could also use this method in a clustered column visual?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2024 09:38:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Merge-rows-on-single-id-in-Direct-Query/m-p/4095038#M162512</guid>
      <dc:creator>MJDS</dc:creator>
      <dc:date>2024-08-12T09:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: Merge rows on single id in Direct Query</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Merge-rows-on-single-id-in-Direct-Query/m-p/4096273#M162556</link>
      <description>&lt;P&gt;How would that look like?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 00:55:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Merge-rows-on-single-id-in-Direct-Query/m-p/4096273#M162556</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-08-13T00:55:38Z</dc:date>
    </item>
    <item>
      <title>Re: Merge rows on single id in Direct Query</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Merge-rows-on-single-id-in-Direct-Query/m-p/4097123#M162584</link>
      <description>&lt;P&gt;I was thinking an average of the allocation days in the y axis and then month from a date table linked to the created value in the model.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 08:10:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Merge-rows-on-single-id-in-Direct-Query/m-p/4097123#M162584</guid>
      <dc:creator>MJDS</dc:creator>
      <dc:date>2024-08-13T08:10:54Z</dc:date>
    </item>
  </channel>
</rss>

