<?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: Get the previous value from a matrix with two rows in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-the-previous-value-from-a-matrix-with-two-rows/m-p/3757078#M146573</link>
    <description>&lt;P&gt;Hi&amp;nbsp; &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="703539" data-lia-user-login="brendanmacdonal" class="lia-mention lia-mention-user"&gt;brendanmacdonal&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;May I ask if the incorrect totals you are referring to are the incorrect totals for the Total rows that are placed on the form visual?&lt;/P&gt;
&lt;P&gt;Measure follows the context of the "Total" row and is calculated in that context. Therefore, using a measure in a column of a table visualization may have unexpected values in the "Total" column.&lt;/P&gt;
&lt;P&gt;You can use the following measure, using the IF()+HASONEVALUE() function, to determine if it is Total, and if it is, you can calculate it according to your own needs, such as Average, Sum, etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try using the following measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure_ totals =
var _table=SUMMARIZE('Table','Table'[MonthYear],"Value",[Measure])
return
IF(
    HASONEVALUE('Table'[MonthYear]),[Measure],SUMX(_table,[Value]))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Liu Yang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;Accept it as the solution&lt;/EM&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Tue, 12 Mar 2024 06:30:27 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-03-12T06:30:27Z</dc:date>
    <item>
      <title>Get the previous value from a matrix with two rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-the-previous-value-from-a-matrix-with-two-rows/m-p/3754954#M146504</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I need some DAX help with the following scenario.&lt;/P&gt;&lt;P&gt;I have a matrix with two values in the Rows (MonthYear and Run) and I need to calculate the difference between the Run numbers within a MonthYear.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried the following DAX which does give the correct Difference Between Runs but the column totals are incorrect.&lt;/P&gt;&lt;P&gt;Any guidance would be great!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Measure = IF&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;not&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;ISBLANK&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;[Cost]&lt;/SPAN&gt;&lt;SPAN&gt;)),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Table'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'Table'&lt;/SPAN&gt;&lt;SPAN&gt;[Cost]&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;SPAN&gt;OFFSET&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;ALLSELECTED&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Run&lt;/SPAN&gt;&lt;SPAN&gt;), &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;ORDERBY&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Run&lt;/SPAN&gt;&lt;SPAN&gt;[Run Key]&lt;/SPAN&gt;&lt;SPAN&gt;))))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&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, 11 Mar 2024 11:32:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-the-previous-value-from-a-matrix-with-two-rows/m-p/3754954#M146504</guid>
      <dc:creator>brendanmacdonal</dc:creator>
      <dc:date>2024-03-11T11:32:16Z</dc:date>
    </item>
    <item>
      <title>Re: Get the previous value from a matrix with two rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-the-previous-value-from-a-matrix-with-two-rows/m-p/3756261#M146554</link>
      <description>&lt;P&gt;Are you open to using the new Visual Calculations?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2024 20:57:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-the-previous-value-from-a-matrix-with-two-rows/m-p/3756261#M146554</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-03-11T20:57:35Z</dc:date>
    </item>
    <item>
      <title>Re: Get the previous value from a matrix with two rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-the-previous-value-from-a-matrix-with-two-rows/m-p/3757078#M146573</link>
      <description>&lt;P&gt;Hi&amp;nbsp; &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="703539" data-lia-user-login="brendanmacdonal" class="lia-mention lia-mention-user"&gt;brendanmacdonal&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;May I ask if the incorrect totals you are referring to are the incorrect totals for the Total rows that are placed on the form visual?&lt;/P&gt;
&lt;P&gt;Measure follows the context of the "Total" row and is calculated in that context. Therefore, using a measure in a column of a table visualization may have unexpected values in the "Total" column.&lt;/P&gt;
&lt;P&gt;You can use the following measure, using the IF()+HASONEVALUE() function, to determine if it is Total, and if it is, you can calculate it according to your own needs, such as Average, Sum, etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try using the following measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure_ totals =
var _table=SUMMARIZE('Table','Table'[MonthYear],"Value",[Measure])
return
IF(
    HASONEVALUE('Table'[MonthYear]),[Measure],SUMX(_table,[Value]))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Liu Yang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;Accept it as the solution&lt;/EM&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2024 06:30:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-the-previous-value-from-a-matrix-with-two-rows/m-p/3757078#M146573</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-03-12T06:30:27Z</dc:date>
    </item>
  </channel>
</rss>

