<?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: I have 2 DAX expressions that do the same thing except in one product caculation in 1000's in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-have-2-DAX-expressions-that-do-the-same-thing-except-in-one/m-p/4423033#M175585</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your quick reply. I stillcannot find a place to attach my files and now I cannot cfind anywhere to change my password as I forgotton it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;JimmySXS&lt;/P&gt;</description>
    <pubDate>Sat, 22 Feb 2025 11:37:27 GMT</pubDate>
    <dc:creator>JimmySXS</dc:creator>
    <dc:date>2025-02-22T11:37:27Z</dc:date>
    <item>
      <title>I have 2 DAX expressions that do the same thing except in one product caculation in 1000's</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-have-2-DAX-expressions-that-do-the-same-thing-except-in-one/m-p/4417880#M175417</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;First off I am learning DAXand using data sources found on the web to practice. I have created a model and was practicing my DAX and wrote 2 expressions that I thought did the same thing.&lt;BR /&gt;The first one&amp;nbsp;&lt;BR /&gt;1&amp;nbsp;&lt;SPAN&gt;Total &lt;/SPAN&gt;&lt;SPAN&gt;Order&lt;/SPAN&gt;&lt;SPAN&gt; Sales =&lt;/SPAN&gt; &lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;OrderLine&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;OrderLine&lt;/SPAN&gt;&lt;SPAN&gt;[Sales]&lt;/SPAN&gt;&lt;SPAN&gt; * &lt;/SPAN&gt;&lt;SPAN&gt;OrderLine&lt;/SPAN&gt;&lt;SPAN&gt;[Quantity]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;BR /&gt;then the next 2 to get the same value&lt;BR /&gt;2&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Sales After Discount =&lt;/SPAN&gt; &lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;OrderLine&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;[Total Order Sales]&lt;/SPAN&gt;&lt;SPAN&gt; *(&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;-&lt;/SPAN&gt;&lt;SPAN&gt;OrderLine&lt;/SPAN&gt;&lt;SPAN&gt;[Discount]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;BR /&gt;3&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Sales After Discount &lt;/SPAN&gt;&lt;SPAN&gt;2&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;OrderLine&lt;/SPAN&gt;&lt;SPAN&gt;, (&lt;/SPAN&gt;&lt;SPAN&gt;OrderLine&lt;/SPAN&gt;&lt;SPAN&gt;[Sales]&lt;/SPAN&gt;&lt;SPAN&gt; * &lt;/SPAN&gt;&lt;SPAN&gt;OrderLine&lt;/SPAN&gt;&lt;SPAN&gt;[Quantity]&lt;/SPAN&gt;&lt;SPAN&gt;) * (&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;-&lt;/SPAN&gt;&lt;SPAN&gt;OrderLine&lt;/SPAN&gt;&lt;SPAN&gt;[Discount]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;It worked for 1000's of lines then not on 1 and I don't know why? Also I cannot find anywhere to attach the PBIX &amp;amp; xslx files I'm working from sorry.&lt;BR /&gt;&lt;BR /&gt;Jim&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2025 13:56:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-have-2-DAX-expressions-that-do-the-same-thing-except-in-one/m-p/4417880#M175417</guid>
      <dc:creator>JimmySXS</dc:creator>
      <dc:date>2025-02-19T13:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: I have 2 DAX expressions that do the same thing except in one product caculation in 1000's</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-have-2-DAX-expressions-that-do-the-same-thing-except-in-one/m-p/4418044#M175426</link>
      <description>&lt;P&gt;I think that there are duplicate rows in your data, probably in the order line table but possibly in one of the tables order line is related to.&lt;/P&gt;
&lt;P&gt;In your first sales after discount measure you are iterating over order line and then performing context transition by calling the [Total Order Sales] measure. That will put all copies of the duplicate rows into the filter context and you will get the sum of all those duplicates multiplied by the discount.&lt;/P&gt;
&lt;P&gt;In the second version you are not forcing context transition, you are only iterating over the table once, so each duplicate row will only be counted once, not once per the number of duplicates.&lt;/P&gt;
&lt;P&gt;On the attachment point, you can put files on Google Drive, OneDrive or similar and share them from there.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2025 15:46:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-have-2-DAX-expressions-that-do-the-same-thing-except-in-one/m-p/4418044#M175426</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2025-02-19T15:46:52Z</dc:date>
    </item>
    <item>
      <title>Re: I have 2 DAX expressions that do the same thing except in one product caculation in 1000's</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-have-2-DAX-expressions-that-do-the-same-thing-except-in-one/m-p/4418164#M175436</link>
      <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2025 17:41:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-have-2-DAX-expressions-that-do-the-same-thing-except-in-one/m-p/4418164#M175436</guid>
      <dc:creator>LYPowerBI</dc:creator>
      <dc:date>2025-02-19T17:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: I have 2 DAX expressions that do the same thing except in one product caculation in 1000's</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-have-2-DAX-expressions-that-do-the-same-thing-except-in-one/m-p/4421234#M175530</link>
      <description>&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Thanks for the reply from&amp;nbsp;LYPowerBI&amp;nbsp; and&amp;nbsp;johnt75&amp;nbsp;&amp;nbsp;, please allow me to provide another insight:&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&lt;SPAN&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="870139" data-lia-user-login="JimmySXS" class="lia-mention lia-mention-user"&gt;JimmySXS&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;Thanks for reaching out to the Microsoft fabric community forum.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;Yes, as&amp;nbsp;johnt75 mentioned and LYPowerBI verified, if the data itself contains duplicate rows, it can lead to inconsistent calculation results. The SUMX function inherently involves iteration. Below is a screenshot from the official documentation:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;For more details, please refer to:&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="zh-CN"&gt;&lt;A href="https://learn.microsoft.com/en-us/dax/sumx-function-dax#remarks" target="_blank"&gt;https://learn.microsoft.com/en-us/dax/sumx-function-dax#remarks&lt;/A&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="zh-CN"&gt;&lt;A href="https://learn.microsoft.com/en-us/dax/dax-glossary#iterator-function" target="_blank"&gt;https://learn.microsoft.com/en-us/dax/dax-glossary#iterator-function&lt;/A&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;Here is my testing process:&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&lt;SPAN&gt;1.&lt;/SPAN&gt;&lt;SPAN&gt;This is my sample data:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&lt;SPAN&gt;The red box highlights the obvious duplicate data&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="zh-CN"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&lt;SPAN&gt;2..&lt;/SPAN&gt;&lt;SPAN&gt;Here are the final results:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&lt;SPAN&gt;The results are inconsistent&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&lt;SPAN&gt;4.&lt;/SPAN&gt;&lt;SPAN&gt;To modify this, you can try applying a DISTINCT() function to the Sales After Discount measure or the Total Order Sales measure before referencing the table. The final result is as follows:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Please find the attached pbix relevant to the case.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;Of course, if you have any new discoveries or questions, please feel free to get in touch with us.&lt;BR /&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Best Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Leroy Lu&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;If this post &lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider Accept it &lt;EM&gt;&lt;STRONG&gt;as the solution &lt;/STRONG&gt;&lt;/EM&gt;to help the other members find it more quickly.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="zh-CN"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Feb 2025 06:37:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-have-2-DAX-expressions-that-do-the-same-thing-except-in-one/m-p/4421234#M175530</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-02-21T06:37:57Z</dc:date>
    </item>
    <item>
      <title>Re: I have 2 DAX expressions that do the same thing except in one product caculation in 1000's</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-have-2-DAX-expressions-that-do-the-same-thing-except-in-one/m-p/4423033#M175585</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your quick reply. I stillcannot find a place to attach my files and now I cannot cfind anywhere to change my password as I forgotton it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;JimmySXS&lt;/P&gt;</description>
      <pubDate>Sat, 22 Feb 2025 11:37:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-have-2-DAX-expressions-that-do-the-same-thing-except-in-one/m-p/4423033#M175585</guid>
      <dc:creator>JimmySXS</dc:creator>
      <dc:date>2025-02-22T11:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: I have 2 DAX expressions that do the same thing except in one product caculation in 1000's</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-have-2-DAX-expressions-that-do-the-same-thing-except-in-one/m-p/4423037#M175586</link>
      <description>&lt;P&gt;I tried to create a link like you suggested.&lt;BR /&gt;&lt;BR /&gt;&lt;A title="Download" href="https://1drv.ms/f/c/7c72cd885aeffb3e/Eog-QWA1Iq9KnxTaySesKrIBo3Bo91T3GOzxXyUHEmu80A?e=kBZ6EW" target="_self"&gt;Download files&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Feb 2025 11:56:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-have-2-DAX-expressions-that-do-the-same-thing-except-in-one/m-p/4423037#M175586</guid>
      <dc:creator>JimmySXS</dc:creator>
      <dc:date>2025-02-22T11:56:42Z</dc:date>
    </item>
    <item>
      <title>Re: I have 2 DAX expressions that do the same thing except in one product caculation in 1000's</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-have-2-DAX-expressions-that-do-the-same-thing-except-in-one/m-p/4423751#M175617</link>
      <description>&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="870139" data-lia-user-login="JimmySXS" class="lia-mention lia-mention-user"&gt;JimmySXS&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;Thank you for your prompt response.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="zh-CN"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;If you need to upload a PBIX file, I recommend using SharePoint or GitHub and attaching the file link in your reply. Please ensure that any sensitive information is removed.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="zh-CN"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;Here are some links on how to upload data:&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Power-BI-Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;&lt;SPAN&gt;How to provide sample data in the Power BI Forum - Microsoft Fabric Community&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523" target="_blank"&gt;&lt;SPAN&gt;How to Get Your Question Answered Quickly - Microsoft Fabric Community&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Best Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Leroy Lu&lt;/P&gt;</description>
      <pubDate>Mon, 24 Feb 2025 02:10:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-have-2-DAX-expressions-that-do-the-same-thing-except-in-one/m-p/4423751#M175617</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-02-24T02:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: I have 2 DAX expressions that do the same thing except in one product caculation in 1000's</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-have-2-DAX-expressions-that-do-the-same-thing-except-in-one/m-p/4568368#M175654</link>
      <description>&lt;P&gt;I created a [Diff] measure to show when the 2 measures differed, and you can see that there is a difference on e.g. 29 August 2012. Looking at the order lines for that day, using&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;DEFINE
VAR _Date = TREATAS( { DATE( 2012,8,29) }, 'Calendar'[Date] )

EVALUATE
CALCULATETABLE(
	OrderLine,
	_Date
)
ORDER BY OrderLine[OrderID], OrderLine[ProductsID]&lt;/LI-CODE&gt;
&lt;P&gt;you can see that order ID&amp;nbsp;5907386 has a duplicate line for product 29. I'm sure there will be similar duplications for the other dates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2025 10:34:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-have-2-DAX-expressions-that-do-the-same-thing-except-in-one/m-p/4568368#M175654</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2025-02-25T10:34:27Z</dc:date>
    </item>
    <item>
      <title>Re: I have 2 DAX expressions that do the same thing except in one product caculation in 1000's</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-have-2-DAX-expressions-that-do-the-same-thing-except-in-one/m-p/4587466#M175737</link>
      <description>&lt;P&gt;Hi Guys thanks for your replies but I don't think the data is duplicated. Here is one of the products that is incomplete&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2025 08:24:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-have-2-DAX-expressions-that-do-the-same-thing-except-in-one/m-p/4587466#M175737</guid>
      <dc:creator>JimmySXS</dc:creator>
      <dc:date>2025-02-27T08:24:08Z</dc:date>
    </item>
  </channel>
</rss>

