<?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 calculate difference between two columns - related column and count column in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-difference-between-two-columns-related-column/m-p/774651#M3867</link>
    <description>&lt;P&gt;I think this is what i'm trying to do - but have no idea - this DAX stuff is crazy.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I basically want a count of all the during roles for shift b that gets subtracted from the # of required roles for shift b.&amp;nbsp;&amp;nbsp;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CALCULATE(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; COUNTA('Contact Export PowerBI'[During Section and Role]),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Contact Export PowerBI'[During Shift] IN { "B Shift" } - 'Contact Export PowerBI'[RequiredShiftB])&lt;/P&gt;</description>
    <pubDate>Fri, 23 Aug 2019 18:08:05 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-08-23T18:08:05Z</dc:date>
    <item>
      <title>How to calculate difference between two columns - related column and count column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-difference-between-two-columns-related-column/m-p/774315#M3840</link>
      <description>&lt;P&gt;I'm struggling with this.&amp;nbsp; I want to create a column that calculates the difference of (First RequiredShiftA) and (CountDuringShiftA) columns.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This started as two tables.&amp;nbsp; I created new columns in my larger table to add the related columns of the required roles, shift a, and shift b thinking that once they were in the same table it would be easy to just subtract one column from the other - nope.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 13:00:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-difference-between-two-columns-related-column/m-p/774315#M3840</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-23T13:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate difference between two columns - related column and count column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-difference-between-two-columns-related-column/m-p/774604#M3857</link>
      <description>&lt;P&gt;Hi. I think I might me missing something. Did you try creating a new calculated dax column on the big table with the following formula?&lt;/P&gt;&lt;PRE&gt;Table[Column1] - Table[Column2]&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 17:13:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-difference-between-two-columns-related-column/m-p/774604#M3857</guid>
      <dc:creator>ibarrau</dc:creator>
      <dc:date>2019-08-23T17:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate difference between two columns - related column and count column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-difference-between-two-columns-related-column/m-p/774613#M3859</link>
      <description>&lt;P&gt;I did try that but the results are no where near correct.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 17:25:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-difference-between-two-columns-related-column/m-p/774613#M3859</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-23T17:25:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate difference between two columns - related column and count column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-difference-between-two-columns-related-column/m-p/774616#M3860</link>
      <description>&lt;P&gt;For example, using that formula:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;instead of 2 - 2 = 0&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am getting -6&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I'm not exactly sure what is being calculated&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 17:30:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-difference-between-two-columns-related-column/m-p/774616#M3860</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-23T17:30:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate difference between two columns - related column and count column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-difference-between-two-columns-related-column/m-p/774626#M3861</link>
      <description>&lt;P&gt;Are you sure you are checking the result in the data view?&lt;/P&gt;&lt;P&gt;2 - 2 = 6&amp;nbsp; sounds like having the visualization with a value of SUM of calculatedColumn.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you show a picture with the two columns and the substract result from the DataView?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 17:40:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-difference-between-two-columns-related-column/m-p/774626#M3861</guid>
      <dc:creator>ibarrau</dc:creator>
      <dc:date>2019-08-23T17:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate difference between two columns - related column and count column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-difference-between-two-columns-related-column/m-p/774629#M3862</link>
      <description>&lt;P&gt;Are you sure you are checking the result in the data view?&lt;/P&gt;&lt;P&gt;2 - 2 = 6&amp;nbsp; sounds like having the visualization with a value of SUM of calculatedColumn.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you show a picture with the two columns and the substract result from the DataView?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 17:42:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-difference-between-two-columns-related-column/m-p/774629#M3862</guid>
      <dc:creator>ibarrau</dc:creator>
      <dc:date>2019-08-23T17:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate difference between two columns - related column and count column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-difference-between-two-columns-related-column/m-p/774634#M3864</link>
      <description>&lt;P&gt;The one column was a quick measure and doesn't show up in the data view.&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 17:50:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-difference-between-two-columns-related-column/m-p/774634#M3864</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-23T17:50:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate difference between two columns - related column and count column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-difference-between-two-columns-related-column/m-p/774637#M3865</link>
      <description>&lt;P&gt;Then don't use a "quick measure" and create a "calculated column" with the substract.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 17:52:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-difference-between-two-columns-related-column/m-p/774637#M3865</guid>
      <dc:creator>ibarrau</dc:creator>
      <dc:date>2019-08-23T17:52:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate difference between two columns - related column and count column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-difference-between-two-columns-related-column/m-p/774648#M3866</link>
      <description>&lt;P&gt;I've been trying.&amp;nbsp; I get a lot of errors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 18:04:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-difference-between-two-columns-related-column/m-p/774648#M3866</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-23T18:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate difference between two columns - related column and count column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-difference-between-two-columns-related-column/m-p/774651#M3867</link>
      <description>&lt;P&gt;I think this is what i'm trying to do - but have no idea - this DAX stuff is crazy.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I basically want a count of all the during roles for shift b that gets subtracted from the # of required roles for shift b.&amp;nbsp;&amp;nbsp;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CALCULATE(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; COUNTA('Contact Export PowerBI'[During Section and Role]),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Contact Export PowerBI'[During Shift] IN { "B Shift" } - 'Contact Export PowerBI'[RequiredShiftB])&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 18:08:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-difference-between-two-columns-related-column/m-p/774651#M3867</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-23T18:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate difference between two columns - related column and count column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-difference-between-two-columns-related-column/m-p/774653#M3868</link>
      <description>&lt;P&gt;Can you send a picture of the data model? I think if we have only three tables with single directional relation we shouldn't be seeing this error.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 18:10:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-difference-between-two-columns-related-column/m-p/774653#M3868</guid>
      <dc:creator>ibarrau</dc:creator>
      <dc:date>2019-08-23T18:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate difference between two columns - related column and count column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-difference-between-two-columns-related-column/m-p/774663#M3869</link>
      <description>&lt;P&gt;I don't think I'm following the whole idea. Try to use variables to avoid this kind of error. The formula you are showing looks like a measure. I think this code should help:&lt;/P&gt;&lt;PRE&gt;VAR counting = COUNTA('Contact Export PowerBI'[During Section and Role]),

VAR in_shift_b = 
CALCULATE (
    countring , 
    'Contact Export PowerBI'[During Shift] = "B Shift" 
)
 VAR number_of_req_roles = COUNT('Contact Export PowerBI'[RequiredShiftB] )

RETURN
in_shift_b - number_of_req_roles&lt;/PRE&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 18:24:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-difference-between-two-columns-related-column/m-p/774663#M3869</guid>
      <dc:creator>ibarrau</dc:creator>
      <dc:date>2019-08-23T18:24:21Z</dc:date>
    </item>
  </channel>
</rss>

