<?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: issues with RETURN statement from variables in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/issues-with-RETURN-statement-from-variables/m-p/4822409#M184316</link>
    <description>&lt;P&gt;I don't think that this is calculating what you want it to. The Total, Selection and External variables will not be recalculated for each iteration of Company Name. In DAX variables are not really variable, they are constants which are only calculated once.&lt;/P&gt;
&lt;P&gt;If you wish to recalculate for each company then you would need to move the variables inside the SUMX.&lt;/P&gt;</description>
    <pubDate>Wed, 10 Sep 2025 12:34:16 GMT</pubDate>
    <dc:creator>johnt75</dc:creator>
    <dc:date>2025-09-10T12:34:16Z</dc:date>
    <item>
      <title>issues with RETURN statement from variables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/issues-with-RETURN-statement-from-variables/m-p/4821382#M184292</link>
      <description>&lt;P&gt;Hi Community&lt;BR /&gt;&lt;BR /&gt;im trying to create a DAX calculation that evaluates invoiced quantity based on my "Selection" variable. My issue is the return statement, where it wont divide my number with 1000 which i use to convert from kg to tonnes. How can i change my code to. Any tips for the overall structure of my code will also be helpful.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Se snippet below for context.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thank you!&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Sep 2025 12:17:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/issues-with-RETURN-statement-from-variables/m-p/4821382#M184292</guid>
      <dc:creator>Nicpet0</dc:creator>
      <dc:date>2025-09-09T12:17:33Z</dc:date>
    </item>
    <item>
      <title>Re: issues with RETURN statement from variables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/issues-with-RETURN-statement-from-variables/m-p/4821427#M184293</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="566246" data-lia-user-login="Nicpet0" class="lia-mention lia-mention-user"&gt;Nicpet0&lt;/a&gt;&amp;nbsp;, Try using&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;VAR Total =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;[Invoiced Quantity (Base) LYTD],&lt;BR /&gt;KEEPFILTERS(&lt;BR /&gt;Customer[Customer Posting Group] IN {"Group", "Group_SBU", "Retail", "Wholesale", "Grower"}&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;VAR External =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;[Invoiced Quantity (Base) LYTD],&lt;BR /&gt;KEEPFILTERS(&lt;BR /&gt;Customer[Customer Posting Group] IN {"Retail", "Wholesale", "Grower"}&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;VAR Selection =&lt;BR /&gt;IF(&lt;BR /&gt;SELECTEDVALUE('Type of Sales'[Intercompany Sales]) = "On",&lt;BR /&gt;Total,&lt;BR /&gt;External&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;RETURN&lt;BR /&gt;SUMX(&lt;BR /&gt;VALUES('Company'[Company Name]),&lt;BR /&gt;IF(&lt;BR /&gt;'Company'[Company Name] = "", // Ensure this condition is correct&lt;BR /&gt;(Selection * 0.45359) / 1000,&lt;BR /&gt;Selection / 1000&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Tue, 09 Sep 2025 12:43:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/issues-with-RETURN-statement-from-variables/m-p/4821427#M184293</guid>
      <dc:creator>bhanu_gautam</dc:creator>
      <dc:date>2025-09-09T12:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: issues with RETURN statement from variables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/issues-with-RETURN-statement-from-variables/m-p/4821431#M184294</link>
      <description>&lt;P&gt;Thanks your input&lt;BR /&gt;&lt;BR /&gt;Yes the condition is correct. Nothing changes for me, since the code is the exact same as before&lt;/P&gt;</description>
      <pubDate>Tue, 09 Sep 2025 12:52:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/issues-with-RETURN-statement-from-variables/m-p/4821431#M184294</guid>
      <dc:creator>Nicpet0</dc:creator>
      <dc:date>2025-09-09T12:52:35Z</dc:date>
    </item>
    <item>
      <title>Re: issues with RETURN statement from variables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/issues-with-RETURN-statement-from-variables/m-p/4822409#M184316</link>
      <description>&lt;P&gt;I don't think that this is calculating what you want it to. The Total, Selection and External variables will not be recalculated for each iteration of Company Name. In DAX variables are not really variable, they are constants which are only calculated once.&lt;/P&gt;
&lt;P&gt;If you wish to recalculate for each company then you would need to move the variables inside the SUMX.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Sep 2025 12:34:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/issues-with-RETURN-statement-from-variables/m-p/4822409#M184316</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2025-09-10T12:34:16Z</dc:date>
    </item>
    <item>
      <title>Re: issues with RETURN statement from variables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/issues-with-RETURN-statement-from-variables/m-p/4826038#M184404</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="566246" data-lia-user-login="Nicpet0" class="lia-mention lia-mention-user"&gt;Nicpet0&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Thanks for reaching out to the Microsoft fabric community forum.&lt;/P&gt;
&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="240987" data-lia-user-login="johnt75" class="lia-mention lia-mention-user"&gt;johnt75&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="625922" data-lia-user-login="bhanu_gautam" class="lia-mention lia-mention-user"&gt;bhanu_gautam&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your prompt response&lt;/P&gt;
&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="566246" data-lia-user-login="Nicpet0" class="lia-mention lia-mention-user"&gt;Nicpet0&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;wanted to follow up and confirm whether you’ve had the opportunity to review the information&amp;nbsp; provided by&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="240987" data-lia-user-login="johnt75" class="lia-mention lia-mention-user"&gt;johnt75&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="625922" data-lia-user-login="bhanu_gautam" class="lia-mention lia-mention-user"&gt;bhanu_gautam&lt;/a&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;. If you have any questions or need further clarification, please don’t hesitate to reach out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We appreciate your collaboration and support!&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Best regards,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Lakshmi.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Sep 2025 08:18:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/issues-with-RETURN-statement-from-variables/m-p/4826038#M184404</guid>
      <dc:creator>v-lgarikapat</dc:creator>
      <dc:date>2025-09-15T08:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: issues with RETURN statement from variables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/issues-with-RETURN-statement-from-variables/m-p/4829379#M184480</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="566246" data-lia-user-login="Nicpet0" class="lia-mention lia-mention-user"&gt;Nicpet0&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT&gt;&lt;SPAN&gt;We’d like to confirm whether your issue has been successfully resolved. If you still have any questions or need further assistance, please don’t hesitate to reach out. We’re more than happy to continue supporting you.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;We appreciate your engagement and thank you for being an active part of the community.&lt;/P&gt;
&lt;P&gt;&lt;FONT&gt;&lt;BR /&gt;&lt;STRONG&gt;Best Regards,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Lakshmi.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Sep 2025 07:32:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/issues-with-RETURN-statement-from-variables/m-p/4829379#M184480</guid>
      <dc:creator>v-lgarikapat</dc:creator>
      <dc:date>2025-09-18T07:32:28Z</dc:date>
    </item>
    <item>
      <title>Re: issues with RETURN statement from variables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/issues-with-RETURN-statement-from-variables/m-p/4832080#M184572</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/566246" target="_blank"&gt;@Nicpet0&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT&gt;&lt;SPAN&gt;We’d like to confirm whether your issue has been successfully resolved. If you still have any questions or need further assistance, please don’t hesitate to reach out. We’re more than happy to continue supporting you.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;We appreciate your engagement and thank you for being an active part of the community.&lt;/P&gt;
&lt;P&gt;&lt;FONT&gt;&lt;BR /&gt;&lt;STRONG&gt;Best Regards,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Lakshmi.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Sep 2025 09:18:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/issues-with-RETURN-statement-from-variables/m-p/4832080#M184572</guid>
      <dc:creator>v-lgarikapat</dc:creator>
      <dc:date>2025-09-22T09:18:00Z</dc:date>
    </item>
  </channel>
</rss>

