<?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 Incorrect Total in Matrix - Trying to Produce Average in the Total in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-Total-in-Matrix-Trying-to-Produce-Average-in-the-Total/m-p/3615869#M139791</link>
    <description>&lt;P&gt;Thank you in advance for the help, so I have the below DAX measure that is technically producing the correct values for each month, however my total is incorrect. &lt;STRONG&gt;I want my total to produce the average of all the months in 2023 below&lt;/STRONG&gt;. So the correct average would be $18.65 instead of $26.58 (per below screenshot). How can I change my measure to do this? I believe I need an AVERAGEX or a HASONEVALUE function, but not sure about the proper syntax.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;WTI - WCS Diff ($US/bbl) - Hardisty =&lt;/P&gt;&lt;P&gt;VAR LastDayWithPrice =&lt;/P&gt;&lt;P&gt;CALCULATE(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; LASTNONBLANKVALUE(Data[PriceDate], MAX(Data[PriceDate])),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Data[symbol]="#DG.MO_INDEX.WCS_HRD/CURVE/M00")&lt;/P&gt;&lt;P&gt;VAR Price =&lt;/P&gt;&lt;P&gt;CALCULATE(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; [Average Close],&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Data[PriceDate]=LastDayWithPrice,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Data[symbol]="#DG.MO_INDEX.WCS_HRD/CURVE/M00")&lt;/P&gt;&lt;P&gt;RETURN&lt;/P&gt;&lt;P&gt;ABS(Price)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Matrix Visual (total is incorrect, monthly values are correct). I want the total to be an average of the monthly values.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Fields in Matrix:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 04 Jan 2024 15:09:03 GMT</pubDate>
    <dc:creator>auzzieb</dc:creator>
    <dc:date>2024-01-04T15:09:03Z</dc:date>
    <item>
      <title>Incorrect Total in Matrix - Trying to Produce Average in the Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-Total-in-Matrix-Trying-to-Produce-Average-in-the-Total/m-p/3615869#M139791</link>
      <description>&lt;P&gt;Thank you in advance for the help, so I have the below DAX measure that is technically producing the correct values for each month, however my total is incorrect. &lt;STRONG&gt;I want my total to produce the average of all the months in 2023 below&lt;/STRONG&gt;. So the correct average would be $18.65 instead of $26.58 (per below screenshot). How can I change my measure to do this? I believe I need an AVERAGEX or a HASONEVALUE function, but not sure about the proper syntax.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;WTI - WCS Diff ($US/bbl) - Hardisty =&lt;/P&gt;&lt;P&gt;VAR LastDayWithPrice =&lt;/P&gt;&lt;P&gt;CALCULATE(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; LASTNONBLANKVALUE(Data[PriceDate], MAX(Data[PriceDate])),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Data[symbol]="#DG.MO_INDEX.WCS_HRD/CURVE/M00")&lt;/P&gt;&lt;P&gt;VAR Price =&lt;/P&gt;&lt;P&gt;CALCULATE(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; [Average Close],&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Data[PriceDate]=LastDayWithPrice,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Data[symbol]="#DG.MO_INDEX.WCS_HRD/CURVE/M00")&lt;/P&gt;&lt;P&gt;RETURN&lt;/P&gt;&lt;P&gt;ABS(Price)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Matrix Visual (total is incorrect, monthly values are correct). I want the total to be an average of the monthly values.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Fields in Matrix:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2024 15:09:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-Total-in-Matrix-Trying-to-Produce-Average-in-the-Total/m-p/3615869#M139791</guid>
      <dc:creator>auzzieb</dc:creator>
      <dc:date>2024-01-04T15:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect Total in Matrix - Trying to Produce Average in the Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-Total-in-Matrix-Trying-to-Produce-Average-in-the-Total/m-p/3616635#M139832</link>
      <description>&lt;P&gt;You don't really need any code. Set the implicit aggregation of the WTI -WCS field to "average"&amp;nbsp; rather than "sum"&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2024 00:36:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-Total-in-Matrix-Trying-to-Produce-Average-in-the-Total/m-p/3616635#M139832</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-01-05T00:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect Total in Matrix - Trying to Produce Average in the Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-Total-in-Matrix-Trying-to-Produce-Average-in-the-Total/m-p/3618000#M139871</link>
      <description>&lt;P&gt;But this is a measure not a column. I can't just easily change the aggregation with the measure like I can with a column.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2024 14:15:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-Total-in-Matrix-Trying-to-Produce-Average-in-the-Total/m-p/3618000#M139871</guid>
      <dc:creator>auzzieb</dc:creator>
      <dc:date>2024-01-05T14:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect Total in Matrix - Trying to Produce Average in the Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-Total-in-Matrix-Trying-to-Produce-Average-in-the-Total/m-p/3618076#M139874</link>
      <description>&lt;P&gt;In that case your approach is the way to go. Use HASONEVALUE to figure out where in the matrix you are, and adjust the computation accordingly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please provide sample data that covers your issue or question &lt;STRONG&gt;completely&lt;/STRONG&gt;, in a &lt;STRONG&gt;usable&lt;/STRONG&gt; format (not as a screenshot).&lt;BR /&gt;&lt;BR /&gt;Do not include sensitive information or anything not related to the issue or question. &lt;BR /&gt;&lt;BR /&gt;If you are unsure how to upload data please refer to &lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216&lt;/A&gt; &lt;BR /&gt;&lt;BR /&gt;Please show the expected outcome based on the sample data you provided. &lt;BR /&gt;&lt;BR /&gt;Want faster answers? &lt;A href="https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2024 15:15:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-Total-in-Matrix-Trying-to-Produce-Average-in-the-Total/m-p/3618076#M139874</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-01-05T15:15:25Z</dc:date>
    </item>
  </channel>
</rss>

