<?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 Rows using DAX in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Combining-Rows-using-DAX/m-p/1442775#M27002</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="92178" data-lia-user-login="AlB" class="lia-mention lia-mention-user"&gt;AlB&lt;/a&gt;&amp;nbsp;Thank you so much for the quick reply!! This is perfect. I went with the 2nd example you provided as there is some logic happening on the other table beyond just the date. Thanks again!&lt;/P&gt;</description>
    <pubDate>Mon, 19 Oct 2020 17:40:43 GMT</pubDate>
    <dc:creator>rbreneman</dc:creator>
    <dc:date>2020-10-19T17:40:43Z</dc:date>
    <item>
      <title>Combining Rows using DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Combining-Rows-using-DAX/m-p/1442756#M27000</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table that contains census data, I've already added DAX columns to this table to return a true/false on whether this is the start date or end date of a stay.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using DAX to create a new table and with UNION I've pulled the start and end date rows in, but I need a way to combine these rows so that I end up with a single row containing RoomID, BedID, ResidentID, StartDate, and EndDate values. Screenshot below illustrates what I currently have. This needs to occur with DAX as the data in the other table is already using DAX to determine the start and end dates so the neccessary logic wouldn't available to me from query editor. Maybe UNION isn't the best way to approach this, if so, I'm open to anything that works!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much!&lt;/P&gt;&lt;P&gt;Ryan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2020 17:17:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Combining-Rows-using-DAX/m-p/1442756#M27000</guid>
      <dc:creator>rbreneman</dc:creator>
      <dc:date>2020-10-19T17:17:28Z</dc:date>
    </item>
    <item>
      <title>Re: Combining Rows using DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Combining-Rows-using-DAX/m-p/1442762#M27001</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="232555" data-lia-user-login="rbreneman" class="lia-mention lia-mention-user"&gt;rbreneman&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't think you need the UNION. You could just do (Table1 is your base table "view_ods...")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;NewTable =
ADDCOLUMNS (
    SUMMARIZE ( Table1, Table1[RoomID], Table1[BedID], Table1[ResidentID] ),
    "StartDate", CALCULATE ( MIN ( Table1[CensusDate] ) ),
    "EndDate", CALCULATE ( MAX ( Table1[CensusDate] ) )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where we are assuming the StartDate is the earliest on and the EndDate is the latest one. If you do need the check you use in your code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;NewTable =
ADDCOLUMNS (
    SUMMARIZE ( Table1, Table1[RoomID], Table1[BedID], Table1[ResidentID] ),
    "StartDate", CALCULATE ( DISTINCT ( Table1[CensusDate] ), Table1[IsEarliestByDate] = TRUE () ),
    "EndDate", CALCULATE ( DISTINCT ( Table1[CensusDate] ), Table1[IsLatestByDate] = TRUE () )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Please mark the question solved when done and consider &lt;FONT color="#FF9900"&gt;giving kudos if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Cheers&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2020 17:39:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Combining-Rows-using-DAX/m-p/1442762#M27001</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2020-10-19T17:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: Combining Rows using DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Combining-Rows-using-DAX/m-p/1442775#M27002</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="92178" data-lia-user-login="AlB" class="lia-mention lia-mention-user"&gt;AlB&lt;/a&gt;&amp;nbsp;Thank you so much for the quick reply!! This is perfect. I went with the 2nd example you provided as there is some logic happening on the other table beyond just the date. Thanks again!&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2020 17:40:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Combining-Rows-using-DAX/m-p/1442775#M27002</guid>
      <dc:creator>rbreneman</dc:creator>
      <dc:date>2020-10-19T17:40:43Z</dc:date>
    </item>
  </channel>
</rss>

