<?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: Summing an IF Statement in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-an-IF-Statement/m-p/3207593#M116873</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="240987" data-lia-user-login="johnt75" class="lia-mention lia-mention-user"&gt;johnt75&lt;/a&gt;!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the suggestion.&amp;nbsp; Still not summing, but I'm guessing it's because I'm using a measure as my table reference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My total baseline measurement is including a date range.&amp;nbsp; So between these two dates, sum the qty of units sold.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Total Qty Baseline = CALCULATE(SUM('DOCUMENTS'[Quantity]),DATESBETWEEN('DOCUMENTS'[Posting Date], DATE(2022,10,01),DATE(2023,04,07)))+0&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;New Distribution Qty AMJ:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Total Qty AMJ = CALCULATE(SUM('DOCUMENTS'[Quantity]),DATESBETWEEN('DOCUMENTS'[Posting Date], DATE(2023,04,08),DATE(2023,06,30)))+0&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If Baseline qty was zero, then calculate sum AMJ qty&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;New Distribution Qty AMJ = 
IF([Total Qty Baseline] = 0,
[Total Qty AMJ],
0)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I'm trying to show - if baseline qty was zero, then show "1" (meaning new distribution).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Even trying to use the table "Documents" within the sumx formula, would not allow for 1 to show.&amp;nbsp; Instead it would count the documents.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;&lt;P&gt;Christina&lt;/P&gt;</description>
    <pubDate>Wed, 26 Apr 2023 15:33:52 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-04-26T15:33:52Z</dc:date>
    <item>
      <title>Summing an IF Statement</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-an-IF-Statement/m-p/3207453#M116855</link>
      <description>&lt;P&gt;Hi Community!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking to create an accurate Sum total column (see highlighted totals below):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This Gaps closed measure is:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Gaps Closed = 
IF([Total Qty Baseline]= 0,
1,
0)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;Count of Reorders measure is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Count of Reorders = [New Distriubtion Count AMJ] - [Gaps Closed]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I feel like I'm overthinking this, but is there a simple solution to have a Sum total column when using an IF statement?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&amp;nbsp;&lt;/P&gt;&lt;P&gt;Christina&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2023 14:12:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-an-IF-Statement/m-p/3207453#M116855</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-04-26T14:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: Summing an IF Statement</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-an-IF-Statement/m-p/3207506#M116859</link>
      <description>&lt;P&gt;You need to iterate over the table so the calculation is done row by row, e.g.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Gaps Closed =
SUMX ( 'Table', IF ( [Total Qty Baseline] = 0, 1, 0 ) )
&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 26 Apr 2023 14:38:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-an-IF-Statement/m-p/3207506#M116859</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2023-04-26T14:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: Summing an IF Statement</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-an-IF-Statement/m-p/3207593#M116873</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="240987" data-lia-user-login="johnt75" class="lia-mention lia-mention-user"&gt;johnt75&lt;/a&gt;!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the suggestion.&amp;nbsp; Still not summing, but I'm guessing it's because I'm using a measure as my table reference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My total baseline measurement is including a date range.&amp;nbsp; So between these two dates, sum the qty of units sold.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Total Qty Baseline = CALCULATE(SUM('DOCUMENTS'[Quantity]),DATESBETWEEN('DOCUMENTS'[Posting Date], DATE(2022,10,01),DATE(2023,04,07)))+0&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;New Distribution Qty AMJ:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Total Qty AMJ = CALCULATE(SUM('DOCUMENTS'[Quantity]),DATESBETWEEN('DOCUMENTS'[Posting Date], DATE(2023,04,08),DATE(2023,06,30)))+0&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If Baseline qty was zero, then calculate sum AMJ qty&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;New Distribution Qty AMJ = 
IF([Total Qty Baseline] = 0,
[Total Qty AMJ],
0)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I'm trying to show - if baseline qty was zero, then show "1" (meaning new distribution).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Even trying to use the table "Documents" within the sumx formula, would not allow for 1 to show.&amp;nbsp; Instead it would count the documents.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;&lt;P&gt;Christina&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2023 15:33:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-an-IF-Statement/m-p/3207593#M116873</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-04-26T15:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: Summing an IF Statement</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-an-IF-Statement/m-p/3207633#M116881</link>
      <description>&lt;P&gt;The table you use to iterate over in the SUMX needs to match the values you are showing in the visual, so it needs enough columns to uniquely identify each row in the visual. If you have a fact table holding sales, and dimension tables holding other columns you could do something like&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Gaps Closed =
SUMX (
    SUMMARIZE (
        'Sales',
        'Territory'[Territory Code],
        'Customer'[Customer number],
        'Items'[Item number]
    ),
    IF ( [Total Qty Baseline] = 0, 1, 0 )
)
&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 26 Apr 2023 16:00:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-an-IF-Statement/m-p/3207633#M116881</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2023-04-26T16:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: Summing an IF Statement</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-an-IF-Statement/m-p/3207776#M116901</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="240987" data-lia-user-login="johnt75" class="lia-mention lia-mention-user"&gt;johnt75&lt;/a&gt;&amp;nbsp; Yayyy!&amp;nbsp; It worked!!!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt; Thank you so so much!!!!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2023 17:40:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-an-IF-Statement/m-p/3207776#M116901</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-04-26T17:40:33Z</dc:date>
    </item>
    <item>
      <title>Re: Summing an IF Statement</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-an-IF-Statement/m-p/3529058#M135603</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="240987" data-lia-user-login="johnt75" class="lia-mention lia-mention-user"&gt;johnt75&lt;/a&gt;!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking to add onto this already created dax function you graciously helped me with.&amp;nbsp; I am looking to add the months as well onto this table, but having it only count for the first order of the date time frame (instead of each month).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the formula you helped me with shows (correct result):&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But then when I add in months to the table- this is the result I get:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas on how I could add in a date filter so the formula is only calcuating the first posting of all months in the dataset?&lt;/P&gt;&lt;P&gt;ex. if customer ordered in August and September, - only count August Order.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much,&lt;/P&gt;&lt;P&gt;Christina&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Nov 2023 14:18:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-an-IF-Statement/m-p/3529058#M135603</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-11-11T14:18:43Z</dc:date>
    </item>
  </channel>
</rss>

