<?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 Matrix Table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matrix-Table/m-p/3860113#M150779</link>
    <description>&lt;P&gt;Hello,&amp;nbsp;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to buld a matrix that looks more or less like this.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;the Total occupied units is a measure that stems from the count of all the units that have 'Yes' in the Occupied column in the [Fact_units] table. The date are stored in theh [Dim_proj] tables.&amp;nbsp;&lt;BR /&gt;Projected move ins and move outs are als o measures in another table that counts move ins and move outs.&lt;BR /&gt;The total should be given by the occupied units + move ins - move outs. The next week, however should start with the total from the previous week.&lt;BR /&gt;&lt;BR /&gt;In Excel it's easy because I can just point to a coordinate, which I can't do in DAX.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I managed to do a running total but it doesn't work in a matrix.&lt;BR /&gt;So far, I tried with EARLIER, but I can't get it to work because there is no row context I can latch on to.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I tried to create an if statement, but the problem is always the same: I can't get PBI to take the previous row's result as a basis for the next row starting point. Can someone help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 22 Apr 2024 17:45:54 GMT</pubDate>
    <dc:creator>datagoblin77</dc:creator>
    <dc:date>2024-04-22T17:45:54Z</dc:date>
    <item>
      <title>Matrix Table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matrix-Table/m-p/3860113#M150779</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to buld a matrix that looks more or less like this.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;the Total occupied units is a measure that stems from the count of all the units that have 'Yes' in the Occupied column in the [Fact_units] table. The date are stored in theh [Dim_proj] tables.&amp;nbsp;&lt;BR /&gt;Projected move ins and move outs are als o measures in another table that counts move ins and move outs.&lt;BR /&gt;The total should be given by the occupied units + move ins - move outs. The next week, however should start with the total from the previous week.&lt;BR /&gt;&lt;BR /&gt;In Excel it's easy because I can just point to a coordinate, which I can't do in DAX.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I managed to do a running total but it doesn't work in a matrix.&lt;BR /&gt;So far, I tried with EARLIER, but I can't get it to work because there is no row context I can latch on to.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I tried to create an if statement, but the problem is always the same: I can't get PBI to take the previous row's result as a basis for the next row starting point. Can someone help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Apr 2024 17:45:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matrix-Table/m-p/3860113#M150779</guid>
      <dc:creator>datagoblin77</dc:creator>
      <dc:date>2024-04-22T17:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix Table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matrix-Table/m-p/3860749#M150822</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="728922" data-lia-user-login="datagoblin77" class="lia-mention lia-mention-user"&gt;datagoblin77&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I create a table as you mentioned.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Then I create three measures.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;What can I do is calculating the total by creating a measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;total1 = 'Fact_units'[total] + 'Fact_units'[ins] - 'Fact_units'[outs]&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;So if you can provide me more about your table or details, I will do a further study.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best Regards&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Yilong Zhou&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;helps&lt;/I&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2024 02:03:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matrix-Table/m-p/3860749#M150822</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-04-23T02:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix Table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matrix-Table/m-p/3865616#M151006</link>
      <description>&lt;P&gt;Hello Ylong,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks for your reply. te measure you provided is good. The only problem is that the total has to have an IF statement that depends on a measure. The first weeek of the matrix is actually a COUNT of all the units that have a "yes" in the occupied column.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;If I were to do the same thing in any other programming language I would use a while loop. In pseudocode it should be something like:&lt;BR /&gt;total1=&amp;nbsp;&amp;nbsp;[actual occupied units] + [ins] - [out]&lt;BR /&gt;total2= total1 + [ins] - [out]&lt;BR /&gt;i= 1&lt;BR /&gt;WHILE&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; counter &amp;lt; MAX(weekcount)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IF weekcount = 1&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; total1&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; total2&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;total2 =total2 + ins - out&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;i ++&lt;BR /&gt;This should create a loop that iterates through the weeks. Unfortunately, PBI doesn't have while loops and the&amp;nbsp; variables are static.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2024 13:31:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matrix-Table/m-p/3865616#M151006</guid>
      <dc:creator>datagoblin77</dc:creator>
      <dc:date>2024-04-24T13:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix Table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matrix-Table/m-p/3874852#M151333</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="728922" data-lia-user-login="datagoblin77" class="lia-mention lia-mention-user"&gt;datagoblin77&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;It's true that there's no DAX code in Desktop that directly replicates the While loop statement as of now, but I think you can check out this topic:&amp;nbsp;&lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/For-and-While-Loops-in-DAX/ba-p/636314" target="_blank"&gt;For and While Loops in DAX - Microsoft Fabric Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best Regards&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Yilong Zhou&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;helps&lt;/I&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2024 08:40:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matrix-Table/m-p/3874852#M151333</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-04-29T08:40:19Z</dc:date>
    </item>
  </channel>
</rss>

