<?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 Calc Item to return measures multipled by -1 in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calc-Item-to-return-measures-multipled-by-1/m-p/4130030#M164041</link>
    <description>&lt;P&gt;I'm creating a calculation item that, when applied as a filter, flips the negative or positive signs of a number to the opposite.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g., if a cost is -5000, using this calc item will make it 5000.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So far I am using:&lt;/P&gt;&lt;P&gt;IF(CONTAINSSTRING (SELECTEDMEASURENAME (), "Cost") ||&amp;nbsp;IF(CONTAINSSTRING (SELECTEDMEASURENAME (), "Revenue") ,&lt;BR /&gt;SELECTEDMEASURE () * -1,&lt;BR /&gt;SELECTEDMEASURE ())&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works great if the measure itself contains the string "Cost" or "Revenue" in it. I'd like to know if there is a means of achieving the above without doing a string match, but instead checking the underlying DAX of a measure and then computing from there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g., measure is "Entertainment Cost", which can be calculated by Cost filtered by Entertainment.&amp;nbsp;&lt;/P&gt;&lt;P&gt;CALCULATE([Cost],&lt;BR /&gt;Dim[Cost Type] = "Entertainment")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I check if the measure itself is referring to either the dependent "cost" measure or column above and then doing the flipping of the negative/positive sign.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Mon, 02 Sep 2024 22:13:57 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-09-02T22:13:57Z</dc:date>
    <item>
      <title>Calc Item to return measures multipled by -1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calc-Item-to-return-measures-multipled-by-1/m-p/4130030#M164041</link>
      <description>&lt;P&gt;I'm creating a calculation item that, when applied as a filter, flips the negative or positive signs of a number to the opposite.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g., if a cost is -5000, using this calc item will make it 5000.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So far I am using:&lt;/P&gt;&lt;P&gt;IF(CONTAINSSTRING (SELECTEDMEASURENAME (), "Cost") ||&amp;nbsp;IF(CONTAINSSTRING (SELECTEDMEASURENAME (), "Revenue") ,&lt;BR /&gt;SELECTEDMEASURE () * -1,&lt;BR /&gt;SELECTEDMEASURE ())&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works great if the measure itself contains the string "Cost" or "Revenue" in it. I'd like to know if there is a means of achieving the above without doing a string match, but instead checking the underlying DAX of a measure and then computing from there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g., measure is "Entertainment Cost", which can be calculated by Cost filtered by Entertainment.&amp;nbsp;&lt;/P&gt;&lt;P&gt;CALCULATE([Cost],&lt;BR /&gt;Dim[Cost Type] = "Entertainment")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I check if the measure itself is referring to either the dependent "cost" measure or column above and then doing the flipping of the negative/positive sign.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2024 22:13:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calc-Item-to-return-measures-multipled-by-1/m-p/4130030#M164041</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-09-02T22:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: Calc Item to return measures multipled by -1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calc-Item-to-return-measures-multipled-by-1/m-p/4130043#M164042</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A calculation item can't reference either the DAX code or the measure dependencies of SELECTEDMEASURE ().&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you need to selectively apply a calculation item to measures within DAX expressions, so that the calculation item is applied to either [Cost] or [Revenue] within DAX expressions, I suggest following the method in this article:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.sqlbi.com/articles/using-calculation-groups-to-selectively-replace-measures-in-dax-expressions/" target="_blank"&gt;https://www.sqlbi.com/articles/using-calculation-groups-to-selectively-replace-measures-in-dax-expressions/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: The &lt;A href="https://powerbi.microsoft.com/fi-fi/blog/power-bi-june-2024-feature-summary/#post-27479-_Toc168491982:~:text=Columns%20documentation-,INFO.CALCDEPENDENCY,-DISCOVER_CALC_DEPENDENCY" target="_self"&gt;INFO.CALCDEPENDENCY&lt;/A&gt; function does return dependency information and can be used when querying the model, but cannot be used in measure, calculated column or calculated table definitions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2024 23:48:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calc-Item-to-return-measures-multipled-by-1/m-p/4130043#M164042</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2024-09-02T23:48:04Z</dc:date>
    </item>
    <item>
      <title>Re: Calc Item to return measures multipled by -1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calc-Item-to-return-measures-multipled-by-1/m-p/4130044#M164043</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A calculation item can't reference either the DAX code or the measure dependencies of SELECTEDMEASURE ().&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you need to selectively apply a calculation item to measures within DAX expressions, so that the calculation item is applied to either [Cost] or [Revenue] within DAX expressions, I suggest following the method in this article:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.sqlbi.com/articles/using-calculation-groups-to-selectively-replace-measures-in-dax-expressions/" target="_blank"&gt;https://www.sqlbi.com/articles/using-calculation-groups-to-selectively-replace-measures-in-dax-expressions/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: The &lt;A href="https://powerbi.microsoft.com/fi-fi/blog/power-bi-june-2024-feature-summary/#post-27479-_Toc168491982:~:text=Columns%20documentation-,INFO.CALCDEPENDENCY,-DISCOVER_CALC_DEPENDENCY" target="_self"&gt;INFO.CALCDEPENDENCY&lt;/A&gt; function does return dependency information and can be used when querying the model, but cannot be used in measure, calculated column or calculated table definitions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2024 23:48:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calc-Item-to-return-measures-multipled-by-1/m-p/4130044#M164043</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2024-09-02T23:48:06Z</dc:date>
    </item>
  </channel>
</rss>

