<?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: Sum column A, B if column C has specific value else return sum column A in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-column-A-B-if-column-C-has-specific-value-else-return-sum/m-p/3310773#M123764</link>
    <description>&lt;P&gt;I was not 100% sure whether you want to use it as a measure or calculated column, so I wrote code that works for both. Actually, the same should be true for your solution. In a visual that shows values by Category both solution should perform about the same. With a large number of categories yours might be even faster in the grand total.&lt;/P&gt;</description>
    <pubDate>Fri, 30 Jun 2023 19:56:05 GMT</pubDate>
    <dc:creator>Martin_D</dc:creator>
    <dc:date>2023-06-30T19:56:05Z</dc:date>
    <item>
      <title>Sum column A, B if column C has specific value else return sum column A</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-column-A-B-if-column-C-has-specific-value-else-return-sum/m-p/3310513#M123746</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;My data looks like&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Id&lt;/TD&gt;&lt;TD&gt;Category&lt;/TD&gt;&lt;TD&gt;Sensi1&lt;/TD&gt;&lt;TD&gt;Sensi2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;-50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;TD&gt;-60&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;300&lt;/TD&gt;&lt;TD&gt;-70&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;400&lt;/TD&gt;&lt;TD&gt;-80&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;500&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;-90&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to implement that is Category = A then return Sensi1 + Sensi2 else return Sensi1. How would I do that?&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2023 15:34:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-column-A-B-if-column-C-has-specific-value-else-return-sum/m-p/3310513#M123746</guid>
      <dc:creator>alsm</dc:creator>
      <dc:date>2023-06-30T15:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: Sum column A, B if column C has specific value else return sum column A</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-column-A-B-if-column-C-has-specific-value-else-return-sum/m-p/3310523#M123748</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="484486" data-lia-user-login="alsm" class="lia-mention lia-mention-user"&gt;alsm&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;try&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Conditional Sum = 
SUMX (
    VALUES ( 'Table'[Category] ),
    CALCULATE (
        SUM ( 'Table'[Sensi1] )
    ) +
    IF (
        'Table'[Category] = "A",
        CALCULATE (
            SUM ( 'Table'[Sensi2] )
        )
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-align-right"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-align-right"&gt;&lt;A title="GitHub" href="https://github.com/MartinBubenheimer" target="_blank" rel="noopener"&gt;&lt;img /&gt;&lt;/A&gt;&lt;A title="linkedin" href="https://www.linkedin.com/in/martin-bubenheimer-9ba99271/" target="_blank" rel="noopener"&gt;&lt;img /&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2023 15:51:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-column-A-B-if-column-C-has-specific-value-else-return-sum/m-p/3310523#M123748</guid>
      <dc:creator>Martin_D</dc:creator>
      <dc:date>2023-06-30T15:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: Sum column A, B if column C has specific value else return sum column A</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-column-A-B-if-column-C-has-specific-value-else-return-sum/m-p/3310753#M123763</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="578180" data-lia-user-login="Martin_D" class="lia-mention lia-mention-user"&gt;Martin_D&lt;/a&gt;&amp;nbsp;, thank you. It works.. though the first part&lt;/P&gt;&lt;PRE&gt; VALUES ( 'Table'[Category] )&lt;/PRE&gt;&lt;P&gt;is non-intuitive . Its basically saying evaluate every line on the dashboard. Is it correct?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried and created another variant&lt;/P&gt;&lt;P&gt;total_sensi =&lt;BR /&gt;VAR sensi1 =&lt;BR /&gt;CALCULATE ( SUM ( Table[Sensi1] ) )&lt;BR /&gt;VAR sensi2 =&lt;BR /&gt;CALCULATE ( SUM ( Table[Sens2] ), FILTER ( Table, Table[Sensi2] = "A" ) )&lt;BR /&gt;VAR total_sensi = sensi1 + sensi2&lt;BR /&gt;RETURN&lt;BR /&gt;total_sensi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Answers are same in both cases, is there a way to say one solution is more optimal than other?&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2023 19:33:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-column-A-B-if-column-C-has-specific-value-else-return-sum/m-p/3310753#M123763</guid>
      <dc:creator>alsm</dc:creator>
      <dc:date>2023-06-30T19:33:14Z</dc:date>
    </item>
    <item>
      <title>Re: Sum column A, B if column C has specific value else return sum column A</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-column-A-B-if-column-C-has-specific-value-else-return-sum/m-p/3310773#M123764</link>
      <description>&lt;P&gt;I was not 100% sure whether you want to use it as a measure or calculated column, so I wrote code that works for both. Actually, the same should be true for your solution. In a visual that shows values by Category both solution should perform about the same. With a large number of categories yours might be even faster in the grand total.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2023 19:56:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-column-A-B-if-column-C-has-specific-value-else-return-sum/m-p/3310773#M123764</guid>
      <dc:creator>Martin_D</dc:creator>
      <dc:date>2023-06-30T19:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: Sum column A, B if column C has specific value else return sum column A</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-column-A-B-if-column-C-has-specific-value-else-return-sum/m-p/3310786#M123766</link>
      <description>&lt;P&gt;Thank you for your reply and showing me another way to do it....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FYI: I created a measure (not a column)&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2023 20:03:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-column-A-B-if-column-C-has-specific-value-else-return-sum/m-p/3310786#M123766</guid>
      <dc:creator>alsm</dc:creator>
      <dc:date>2023-06-30T20:03:02Z</dc:date>
    </item>
  </channel>
</rss>

