<?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: How to subtract a dax measure to a value of imported column? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-subtract-a-dax-measure-to-a-value-of-imported-column/m-p/2113412#M48384</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="311823" data-lia-user-login="milkynight" class="lia-mention lia-mention-user"&gt;milkynight&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;if I correctly understand your situation, you need to substract measure from the current value:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;measure =
VAR currentTarget = SELECTEDVALUE ( T[Target] )
RETURN
    [measureName] - currentTarget&lt;/LI-CODE&gt;&lt;P&gt;&lt;FONT size="2" color="#333399"&gt;&lt;EM&gt;If this post helps, then please consider &lt;U&gt;Accept it as the solution&lt;/U&gt; &lt;span class="lia-unicode-emoji" title=":heavy_check_mark:"&gt;✔️&lt;/span&gt;to help the other members find it more quickly.&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 04 Oct 2021 09:42:05 GMT</pubDate>
    <dc:creator>ERD</dc:creator>
    <dc:date>2021-10-04T09:42:05Z</dc:date>
    <item>
      <title>How to subtract a dax measure to a value of imported column?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-subtract-a-dax-measure-to-a-value-of-imported-column/m-p/2113379#M48380</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a simple question that I only encounter now: Why can't I subtract a measure to an imported column?&lt;/P&gt;&lt;P&gt;Below example that &lt;STRONG&gt;Actual sales&lt;/STRONG&gt; (a dax measure) and &lt;STRONG&gt;Target&lt;/STRONG&gt; (imported number) and desired result of &lt;STRONG&gt;Var (Actual Sales - Target)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I normally have Measure - Measure and it's simple, but what shall I do in this situation? Thank you.&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Name&lt;/TD&gt;&lt;TD&gt;Target&lt;/TD&gt;&lt;TD&gt;Actual sales&lt;/TD&gt;&lt;TD&gt;Var&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;100%&lt;/TD&gt;&lt;TD&gt;100%&lt;/TD&gt;&lt;TD&gt;0%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;100%&lt;/TD&gt;&lt;TD&gt;80%&lt;/TD&gt;&lt;TD&gt;-20%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;100%&lt;/TD&gt;&lt;TD&gt;70%&lt;/TD&gt;&lt;TD&gt;-30%&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Mon, 04 Oct 2021 09:30:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-subtract-a-dax-measure-to-a-value-of-imported-column/m-p/2113379#M48380</guid>
      <dc:creator>milkynight</dc:creator>
      <dc:date>2021-10-04T09:30:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to subtract a dax measure to a value of imported column?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-subtract-a-dax-measure-to-a-value-of-imported-column/m-p/2113412#M48384</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="311823" data-lia-user-login="milkynight" class="lia-mention lia-mention-user"&gt;milkynight&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;if I correctly understand your situation, you need to substract measure from the current value:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;measure =
VAR currentTarget = SELECTEDVALUE ( T[Target] )
RETURN
    [measureName] - currentTarget&lt;/LI-CODE&gt;&lt;P&gt;&lt;FONT size="2" color="#333399"&gt;&lt;EM&gt;If this post helps, then please consider &lt;U&gt;Accept it as the solution&lt;/U&gt; &lt;span class="lia-unicode-emoji" title=":heavy_check_mark:"&gt;✔️&lt;/span&gt;to help the other members find it more quickly.&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Oct 2021 09:42:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-subtract-a-dax-measure-to-a-value-of-imported-column/m-p/2113412#M48384</guid>
      <dc:creator>ERD</dc:creator>
      <dc:date>2021-10-04T09:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to subtract a dax measure to a value of imported column?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-subtract-a-dax-measure-to-a-value-of-imported-column/m-p/2113437#M48386</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="311823" data-lia-user-login="milkynight" class="lia-mention lia-mention-user"&gt;milkynight&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;Var=&lt;BR /&gt;Var _AS = [&lt;SPAN&gt;Actual sales]&lt;BR /&gt;Var _Tar =&amp;nbsp;max(table(Target))&lt;BR /&gt;return&lt;BR /&gt;_AS-_Tar&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, please consider&amp;nbsp;&lt;STRONG&gt;accepting&lt;/STRONG&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp;it as the solution&amp;nbsp;&lt;/EM&gt;&lt;/STRONG&gt;to help the other members find it more quickly.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Appreciate your Kudos!!&lt;/STRONG&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Oct 2021 09:49:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-subtract-a-dax-measure-to-a-value-of-imported-column/m-p/2113437#M48386</guid>
      <dc:creator>VahidDM</dc:creator>
      <dc:date>2021-10-04T09:49:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to subtract a dax measure to a value of imported column?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-subtract-a-dax-measure-to-a-value-of-imported-column/m-p/2113516#M48389</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="315278" data-lia-user-login="VahidDM" class="lia-mention lia-mention-user"&gt;VahidDM&lt;/a&gt;&amp;nbsp;thanks, I guess your DAX can be shortened to: &lt;STRONG&gt;Var = [Actual Sales] - max(table [Target])&lt;/STRONG&gt;&lt;EM&gt;?&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Both long and short version works, but I'm curious why we use max for Target?&lt;/P&gt;</description>
      <pubDate>Mon, 04 Oct 2021 10:09:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-subtract-a-dax-measure-to-a-value-of-imported-column/m-p/2113516#M48389</guid>
      <dc:creator>milkynight</dc:creator>
      <dc:date>2021-10-04T10:09:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to subtract a dax measure to a value of imported column?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-subtract-a-dax-measure-to-a-value-of-imported-column/m-p/2113527#M48390</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="291363" data-lia-user-login="ERD" class="lia-mention lia-mention-user"&gt;ERD&lt;/a&gt;&amp;nbsp;thanks so much, it works nicely.&lt;/P&gt;&lt;P&gt;Just curious, does the first clause mean to convert the imported value to Measure? I tried with VALUES originally and it didn't work&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;VAR currentTarget = SELECTEDVALUE ( T[Target] )&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Oct 2021 10:15:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-subtract-a-dax-measure-to-a-value-of-imported-column/m-p/2113527#M48390</guid>
      <dc:creator>milkynight</dc:creator>
      <dc:date>2021-10-04T10:15:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to subtract a dax measure to a value of imported column?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-subtract-a-dax-measure-to-a-value-of-imported-column/m-p/2113529#M48391</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="311823" data-lia-user-login="milkynight" class="lia-mention lia-mention-user"&gt;milkynight&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm glad you found the solution.&lt;/P&gt;&lt;P&gt;You can not use a column name in the measure to find the value;&amp;nbsp;&lt;SPAN&gt;you must wrap the column in an aggregation function like MIN, MAX, SUM, AVERAGE, etc.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;In your case, because you used the Name column, if you use Min or Max, it will return the value corresponding to that row.&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sqlbi.com/articles/row-context-and-filter-context-in-dax/" target="_blank"&gt;https://www.sqlbi.com/articles/row-context-and-filter-context-in-dax/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sqlbi.com/articles/calculated-columns-and-measures-in-dax/" target="_blank"&gt;https://www.sqlbi.com/articles/calculated-columns-and-measures-in-dax/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, please consider&amp;nbsp;&lt;STRONG&gt;accepting&lt;/STRONG&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp;it as the solution&amp;nbsp;&lt;/EM&gt;&lt;/STRONG&gt;to help the other members find it more quickly.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Appreciate your Kudos!!&lt;/STRONG&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Oct 2021 10:20:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-subtract-a-dax-measure-to-a-value-of-imported-column/m-p/2113529#M48391</guid>
      <dc:creator>VahidDM</dc:creator>
      <dc:date>2021-10-04T10:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to subtract a dax measure to a value of imported column?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-subtract-a-dax-measure-to-a-value-of-imported-column/m-p/2113601#M48393</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="311823" data-lia-user-login="milkynight" class="lia-mention lia-mention-user"&gt;milkynight&lt;/a&gt;&amp;nbsp;,&amp;nbsp;SELECTEDVALUE&amp;nbsp;function is used in a measure to return a&lt;SPAN&gt;&amp;nbsp;value when the context for ColumnName has been filtered down to one distinct value. I'd say read and use column value in further calculations instead of 'convert'.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;You can read about the function here:&amp;nbsp;&lt;A href="https://dax.guide/selectedvalue/" target="_blank" rel="noopener"&gt;https://dax.guide/selectedvalue/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Also you could use MAX function instead. In this particular case it will do the same.&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#333399"&gt;&lt;EM&gt;If this post helps, then please consider &lt;U&gt;Accept it as the solution&lt;/U&gt; &lt;span class="lia-unicode-emoji" title=":heavy_check_mark:"&gt;✔️&lt;/span&gt;to help the other members find it more quickly.&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Oct 2021 10:53:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-subtract-a-dax-measure-to-a-value-of-imported-column/m-p/2113601#M48393</guid>
      <dc:creator>ERD</dc:creator>
      <dc:date>2021-10-04T10:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to subtract a dax measure to a value of imported column?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-subtract-a-dax-measure-to-a-value-of-imported-column/m-p/2854196#M91660</link>
      <description>&lt;P&gt;Thanks you, this solution is good for me&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2022 17:23:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-subtract-a-dax-measure-to-a-value-of-imported-column/m-p/2854196#M91660</guid>
      <dc:creator>KatherineS</dc:creator>
      <dc:date>2022-10-20T17:23:43Z</dc:date>
    </item>
  </channel>
</rss>

