<?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: Using VAR and Return in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-VAR-and-Return/m-p/2839818#M90711</link>
    <description>&lt;P&gt;Thats great thank you. Is there also a way to do the same for cal2 also?&lt;BR /&gt;So if Calc1 is blank only return Calc2,&lt;BR /&gt;if Calc2 is blank only return Calc1,&lt;BR /&gt;and if neither Calc1 or Calc2 are blank return Calc3&lt;/P&gt;</description>
    <pubDate>Thu, 13 Oct 2022 13:43:51 GMT</pubDate>
    <dc:creator>Muneeb91</dc:creator>
    <dc:date>2022-10-13T13:43:51Z</dc:date>
    <item>
      <title>Using VAR and Return</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-VAR-and-Return/m-p/2834553#M90391</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Alarm &amp;amp; Efficiency % = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt;&lt;SPAN&gt; __Calc1 = [alarm percentage]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt;&lt;SPAN&gt; __Calc2 = [Efficiency %]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt;&lt;SPAN&gt; __Calc3 = ([Efficiency %]+[alarm percentage])/&lt;/SPAN&gt;&lt;SPAN&gt;2&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;ISBLANK&lt;/SPAN&gt;&lt;SPAN&gt;(__Calc1), __Calc2)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Just need some help with the above please. I want to return Calc3, but if calc1 is showing blank I would like to return cal2&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 11 Oct 2022 16:07:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-VAR-and-Return/m-p/2834553#M90391</guid>
      <dc:creator>Muneeb91</dc:creator>
      <dc:date>2022-10-11T16:07:22Z</dc:date>
    </item>
    <item>
      <title>Re: Using VAR and Return</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-VAR-and-Return/m-p/2834611#M90394</link>
      <description>&lt;P class="lia-align-justify"&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="454837" data-lia-user-login="Muneeb91" class="lia-mention lia-mention-user"&gt;Muneeb91&lt;/a&gt;,&lt;/P&gt;&lt;P class="lia-align-justify"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;Use:&lt;/P&gt;&lt;P class="lia-align-justify"&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;Alarm &amp;amp; Efficiency % =
VAR _Calc1 = [alarm percentage]
VAR _Calc2 = [Efficiency %]
VAR _Calc3 = ([Efficiency %]+[alarm percentage])/2

RETURN
IF(ISBLANK(_Calc1),_Calc2,_Calc3)&lt;/LI-CODE&gt;&lt;P class="lia-align-justify"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;&lt;EM&gt;Works for you? Mark this post as a solution if it does!&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Consider taking a look at my blog:&amp;nbsp;&lt;LI-MESSAGE title="Forecast Period - Graphical Comparison" uid="2832491" url="https://community.powerbi.com/t5/Themes-Gallery/Forecast-Period-Graphical-Comparison/m-p/2832491#U2832491" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-forum-thread lia-fa-icon lia-fa-forum lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2022 16:29:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-VAR-and-Return/m-p/2834611#M90394</guid>
      <dc:creator>Shaurya</dc:creator>
      <dc:date>2022-10-11T16:29:02Z</dc:date>
    </item>
    <item>
      <title>Re: Using VAR and Return</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-VAR-and-Return/m-p/2839818#M90711</link>
      <description>&lt;P&gt;Thats great thank you. Is there also a way to do the same for cal2 also?&lt;BR /&gt;So if Calc1 is blank only return Calc2,&lt;BR /&gt;if Calc2 is blank only return Calc1,&lt;BR /&gt;and if neither Calc1 or Calc2 are blank return Calc3&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 13:43:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-VAR-and-Return/m-p/2839818#M90711</guid>
      <dc:creator>Muneeb91</dc:creator>
      <dc:date>2022-10-13T13:43:51Z</dc:date>
    </item>
    <item>
      <title>Re: Using VAR and Return</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-VAR-and-Return/m-p/2876564#M92963</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="454837" data-lia-user-login="Muneeb91" class="lia-mention lia-mention-user"&gt;Muneeb91&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try this method:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Alarm &amp;amp; Efficiency % =

VAR __Calc1 = 'A&amp;amp;E'[AP]

VAR __Calc2 = 'A&amp;amp;E'[E]

VAR __Calc3 = ( 'A&amp;amp;E'[E] + 'A&amp;amp;E'[AP] ) / 2

RETURN

    SWITCH (

        TRUE (),

        ISBLANK ( __Calc1 ), __Calc2,

        ISBLANK ( __Calc2 ), __Calc1,

        NOT ( ISBLANK ( __Calc1 ) &amp;amp;&amp;amp; ISBLANK ( __Calc2 ) ), __Calc3

    )

&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Community Support Team _Yinliw&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 08:18:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-VAR-and-Return/m-p/2876564#M92963</guid>
      <dc:creator>v-yinliw-msft</dc:creator>
      <dc:date>2022-11-01T08:18:58Z</dc:date>
    </item>
  </channel>
</rss>

