<?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 up the distinct counts with a filter in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-up-the-distinct-counts-with-a-filter/m-p/1309202#M22821</link>
    <description>&lt;P&gt;Thank you for providing sample data.&amp;nbsp; Not sure if this is what you are looking for, but here is a SUMX measure that returns 744 as the result.&amp;nbsp; Your sample data only has 1 site value.&amp;nbsp; Does your actual data have multiple Site values?&amp;nbsp; If so, this measure will calculate the # of down hours for each site and include all in the total.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hours Down =&lt;BR /&gt;SUMX (&lt;BR /&gt;VALUES ( 'in'[Site] ),&lt;BR /&gt;CALCULATE ( DISTINCTCOUNT ( 'in'[Date_Time_History] ) )&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this works for you, please mark it as the solution.&amp;nbsp; Kudos are appreciated too.&amp;nbsp; Please let me know if not.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Pat&lt;/P&gt;</description>
    <pubDate>Thu, 20 Aug 2020 01:01:44 GMT</pubDate>
    <dc:creator>mahoneypat</dc:creator>
    <dc:date>2020-08-20T01:01:44Z</dc:date>
    <item>
      <title>Sum up the distinct counts with a filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-up-the-distinct-counts-with-a-filter/m-p/1305596#M22670</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table that has for each hour if any assets of ours were down.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following calulation which serves my purposes :&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Hours Down = CALCULATE(DISTINCTCOUNT(Site_Availability_Historyz_Data[Date_Time_History]),Site_Availability_Historyz_Data[AssetPK]&amp;lt;&amp;gt;BLANK())&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;This gives me the all of the hours that were down at a given site regardless if there were 3 rows for a given hour even though 3 assets could have been down, and therefore 3 unique rows for 15:00 hours.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;However, the total within the table is not summing the distinct counts. I know I need to use a sumx, but I have having trouble with the syntax. Can anyone help? Initally, I tried the following:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SUMX(Site_Availability_Historyz_Data,CALCULATE(DISTINCTCOUNT(Site_Availability_Historyz_Data[Date_Time_History]),Site_Availability_Historyz_Data[AssetPK]&amp;lt;&amp;gt;BLANK()))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;however, certain rows become inaccurate because it is essentially doubling the count of hours when there are two different assets down at a given hour. &amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Any advice?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 19 Aug 2020 00:17:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-up-the-distinct-counts-with-a-filter/m-p/1305596#M22670</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-08-19T00:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: Sum up the distinct counts with a filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-up-the-distinct-counts-with-a-filter/m-p/1305625#M22673</link>
      <description>Advice is: &lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490&lt;/A&gt;</description>
      <pubDate>Wed, 19 Aug 2020 00:57:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-up-the-distinct-counts-with-a-filter/m-p/1305625#M22673</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-08-19T00:57:30Z</dc:date>
    </item>
    <item>
      <title>Re: Sum up the distinct counts with a filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-up-the-distinct-counts-with-a-filter/m-p/1305789#M22677</link>
      <description>&lt;P&gt;Not totally clear but the issue is probably the table in your SUMX.&amp;nbsp; Please try this pattern in your measure&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;NewMeasure = SUMX(VALUES(Table[Column]), CALCULATE(DISTINCTCOUNT(Site_Availability_Historyz_Data[Date_Time_History]),Site_Availability_Historyz_Data[AssetPK]&amp;lt;&amp;gt;BLANK()))&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Replace Table[Column] with the one used in your table visual.&amp;nbsp; If you have more than one column in your visual, you will need to replace the VALUES( ) expression with a SUMMARIZE one.&amp;nbsp; For example, SUMMARIZE(Table, Table[Column1], Table[Column2]).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this works for you, please mark it as the solution.&amp;nbsp; Kudos are appreciated too.&amp;nbsp; Please let me know if not.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Pat&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 02:26:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-up-the-distinct-counts-with-a-filter/m-p/1305789#M22677</guid>
      <dc:creator>mahoneypat</dc:creator>
      <dc:date>2020-08-19T02:26:42Z</dc:date>
    </item>
    <item>
      <title>Re: Sum up the distinct counts with a filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-up-the-distinct-counts-with-a-filter/m-p/1308202#M22768</link>
      <description>&lt;P&gt;This is my data and how the measure is turning out.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;You'll see that the distinct count will get me 744, which is what I want, but the sumx measure to sum is getting me 921.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll attatch July's data here&amp;nbsp;&lt;A title="Sample Data CSV" href="https://1drv.ms/u/s!Ag08lU4J4vcXslqhttwvvNGL2vEm?e=R4KRAu" target="_self"&gt;https://1drv.ms/u/s!Ag08lU4J4vcXslqhttwvvNGL2vEm?e=R4KRAu&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 16:24:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-up-the-distinct-counts-with-a-filter/m-p/1308202#M22768</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-08-19T16:24:21Z</dc:date>
    </item>
    <item>
      <title>Re: Sum up the distinct counts with a filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-up-the-distinct-counts-with-a-filter/m-p/1309000#M22811</link>
      <description>&lt;P&gt;Still having issues with summarize as its counting duplicates values of column A when column B is different. Would a group by work better?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 23:18:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-up-the-distinct-counts-with-a-filter/m-p/1309000#M22811</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-08-19T23:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: Sum up the distinct counts with a filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-up-the-distinct-counts-with-a-filter/m-p/1309202#M22821</link>
      <description>&lt;P&gt;Thank you for providing sample data.&amp;nbsp; Not sure if this is what you are looking for, but here is a SUMX measure that returns 744 as the result.&amp;nbsp; Your sample data only has 1 site value.&amp;nbsp; Does your actual data have multiple Site values?&amp;nbsp; If so, this measure will calculate the # of down hours for each site and include all in the total.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hours Down =&lt;BR /&gt;SUMX (&lt;BR /&gt;VALUES ( 'in'[Site] ),&lt;BR /&gt;CALCULATE ( DISTINCTCOUNT ( 'in'[Date_Time_History] ) )&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this works for you, please mark it as the solution.&amp;nbsp; Kudos are appreciated too.&amp;nbsp; Please let me know if not.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Pat&lt;/P&gt;</description>
      <pubDate>Thu, 20 Aug 2020 01:01:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-up-the-distinct-counts-with-a-filter/m-p/1309202#M22821</guid>
      <dc:creator>mahoneypat</dc:creator>
      <dc:date>2020-08-20T01:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: Sum up the distinct counts with a filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-up-the-distinct-counts-with-a-filter/m-p/1315593#M23090</link>
      <description>&lt;P&gt;Thank you so much! Can you explain to me why you used sites after values instead of date_Time_history?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2020 18:29:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-up-the-distinct-counts-with-a-filter/m-p/1315593#M23090</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-08-21T18:29:46Z</dc:date>
    </item>
  </channel>
</rss>

