<?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: Count rows where sum is less than 20 filter context DAX issue in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-rows-where-sum-is-less-than-20-filter-context-DAX-issue/m-p/2501783#M69170</link>
    <description>&lt;P&gt;Thank you , let me try this too , will get back&lt;/P&gt;</description>
    <pubDate>Mon, 09 May 2022 10:46:03 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-05-09T10:46:03Z</dc:date>
    <item>
      <title>Count rows where sum is less than 20 filter context DAX issue</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-rows-where-sum-is-less-than-20-filter-context-DAX-issue/m-p/2485757#M68241</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;I am facing an issue while creating a column "Asset&amp;lt;20h" which count the number of assets which have worked less than 20 hours.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have date and branch as my external filters and I need to show this count on a card as in the screen shot:&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;The card should show "3" as there are three assets with less than 20 hours for these filters. This is my calculated column:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Asset&amp;lt;20h = CALCULATE(DISTINCTCOUNT(ByAsset[Asset Number]),FILTER(ALLEXCEPT(ByAsset,ByAsset[Asset Number],ByAsset[Branch],ByAsset[Date]),sum(ByAsset[Total hours])&amp;lt;20 ))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Powerbi file is here:&amp;nbsp;&lt;A href="https://drive.google.com/file/d/1b1n62BrcZLfr51Q84n3fxlOFvmUvYahD/view?usp=sharing" target="_blank" rel="noopener"&gt;https://drive.google.com/file/d/1b1n62BrcZLfr51Q84n3fxlOFvmUvYahD/view?usp=sharing&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your help is requested.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;And All.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2022 12:31:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-rows-where-sum-is-less-than-20-filter-context-DAX-issue/m-p/2485757#M68241</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-04-29T12:31:03Z</dc:date>
    </item>
    <item>
      <title>Re: Count rows where sum is less than 20 filter context DAX issue</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-rows-where-sum-is-less-than-20-filter-context-DAX-issue/m-p/2485940#M68257</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;I think with all of your data, the best approach is for you to have a data model. I have created one for you and will attach it here. I noticed a number of entries with no Asset assigned but date and hours. I provided meausres not calculated columns as the calc column is not a good practice for the answers you want.&lt;/P&gt;&lt;P&gt;I hope this solves your question and positions you better to do more complex analysis down the road. I think you want assets 20 hours or more, as that figure ties into Naval for July 2021. You will notice separate unique tables for dates, branches and assets. These are the tables to pull fields from for your visuals. You can actually deleted branch name and asset name from your main table, but I have left them in so you can see what is occuring. I had to download and bring in your Table to get access to make these updates.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A title="Asset and Hours" href="https://drive.google.com/file/d/1d3BB5zZN8d8hdumLfdYLt-80cMNqaKlM/view?usp=sharing" target="_self"&gt;https://drive.google.com/file/d/1d3BB5zZN8d8hdumLfdYLt-80cMNqaKlM/view?usp=sharing&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this solves your question.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2022 14:14:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-rows-where-sum-is-less-than-20-filter-context-DAX-issue/m-p/2485940#M68257</guid>
      <dc:creator>Whitewater100</dc:creator>
      <dc:date>2022-04-29T14:14:29Z</dc:date>
    </item>
    <item>
      <title>Re: Count rows where sum is less than 20 filter context DAX issue</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-rows-where-sum-is-less-than-20-filter-context-DAX-issue/m-p/2486337#M68287</link>
      <description>&lt;P&gt;Thank you so much WhiteWater for your time but the issue did not resolve currently,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;May be you understand my req incorrectly, basically I want to count number of assets which has worked less than 20 hours for any particular branch and date range.&lt;/P&gt;&lt;P&gt;so in this screenshot for Date range 1-31 july 2021 , you can see raw data in the table , the first three rows&amp;nbsp; have total hours less than 20 as highlighted, while others have more than 20 ,&amp;nbsp; so the card "Asset &amp;lt;20 hours" should show count of "3" rather than 986 currently. Let me know if any confusion.&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;</description>
      <pubDate>Fri, 29 Apr 2022 18:24:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-rows-where-sum-is-less-than-20-filter-context-DAX-issue/m-p/2486337#M68287</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-04-29T18:24:39Z</dc:date>
    </item>
    <item>
      <title>Re: Count rows where sum is less than 20 filter context DAX issue</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-rows-where-sum-is-less-than-20-filter-context-DAX-issue/m-p/2487032#M68333</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you may try&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Asset&amp;lt;20h =
SUMX (
    SUMMARIZE ( ByAsset, ByAsset[Asset Number], ByAsset[Date] ),
    CALCULATE ( IF ( SUM ( ByAsset[Total hours] ) &amp;lt; 20, 1 ) )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 30 Apr 2022 22:27:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-rows-where-sum-is-less-than-20-filter-context-DAX-issue/m-p/2487032#M68333</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-04-30T22:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: Count rows where sum is less than 20 filter context DAX issue</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-rows-where-sum-is-less-than-20-filter-context-DAX-issue/m-p/2487263#M68343</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;That was a challenge because to get the answer you want you seem like it is a monthly figure, not daily to be used with a day slicer. I was stuck on 986 no matter what approach used. Here is a version to arrive at the monthly assets &amp;lt; 20, with Naval Base in July 2021 with an answer of 3.&amp;nbsp; I hope this is what answer you are looking for.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Assets &amp;lt;20h (MO) = &lt;/SPAN&gt;&lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;SUMMARIZE&lt;/SPAN&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;AssetFactTable&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;AssetFactTable[Asset Number]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;AssetFactTable[Month]&lt;/SPAN&gt;&lt;SPAN&gt; ), &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;AssetFactTable[Total hours]&lt;/SPAN&gt;&lt;SPAN&gt; ) &amp;lt; &lt;/SPAN&gt;&lt;SPAN&gt;20&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt; ) ) ) &lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A title="Assets &amp;lt; 20" href="https://drive.google.com/file/d/1ou-HRUaKqFuslTxWuo8g_lC4YC2jAvTj/view?usp=sharing" target="_self"&gt;https://drive.google.com/file/d/1ou-HRUaKqFuslTxWuo8g_lC4YC2jAvTj/view?usp=sharing&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 01 May 2022 13:20:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-rows-where-sum-is-less-than-20-filter-context-DAX-issue/m-p/2487263#M68343</guid>
      <dc:creator>Whitewater100</dc:creator>
      <dc:date>2022-05-01T13:20:46Z</dc:date>
    </item>
    <item>
      <title>Re: Count rows where sum is less than 20 filter context DAX issue</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-rows-where-sum-is-less-than-20-filter-context-DAX-issue/m-p/2498297#M69002</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you can get result directly by this code.&lt;/P&gt;
&lt;P&gt;Measure:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Asset&amp;lt;20h =
VAR _TOTALHOURS =
    SUMMARIZE (
        ALLSELECTED ( ByAsset ),
        ByAsset[Asset Number],
        "Total Hours", CALCULATE ( SUM ( ByAsset[Total hours] ) )
    )
RETURN
    COUNTAX ( FILTER ( _TOTALHOURS, [Total Hours] &amp;lt; 20 ), [Asset Number] )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result is as below.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2022 09:50:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-rows-where-sum-is-less-than-20-filter-context-DAX-issue/m-p/2498297#M69002</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-05-06T09:50:28Z</dc:date>
    </item>
    <item>
      <title>Re: Count rows where sum is less than 20 filter context DAX issue</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-rows-where-sum-is-less-than-20-filter-context-DAX-issue/m-p/2501781#M69169</link>
      <description>&lt;P&gt;Hi Rico, apologies for delayed response as holidays were in progress here ,&lt;/P&gt;&lt;P&gt;thank you for your response, you solution works good, but if I do a multi select filter like choose many branches the sum goes off, I have a requirement for showing total hours for multiple branches too, can you assist, I just tried, it should gives us "4":&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Asset&amp;lt;20h =
VAR _TOTALHOURS =
SUMMARIZE (
Filter(ByAsset,ByAsset[Branch] in {"Naval Base","Boddington"}),
ByAsset[Asset Number],
"Total Hours", SUM ( ByAsset[Total hours] )
)
RETURN
COUNTAX ( FILTER ( _TOTALHOURS, [Total Hours] &amp;lt; 20 ), [Asset Number] )&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 09 May 2022 10:45:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-rows-where-sum-is-less-than-20-filter-context-DAX-issue/m-p/2501781#M69169</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-05-09T10:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: Count rows where sum is less than 20 filter context DAX issue</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-rows-where-sum-is-less-than-20-filter-context-DAX-issue/m-p/2501783#M69170</link>
      <description>&lt;P&gt;Thank you , let me try this too , will get back&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 10:46:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-rows-where-sum-is-less-than-20-filter-context-DAX-issue/m-p/2501783#M69170</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-05-09T10:46:03Z</dc:date>
    </item>
    <item>
      <title>Re: Count rows where sum is less than 20 filter context DAX issue</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-rows-where-sum-is-less-than-20-filter-context-DAX-issue/m-p/2501785#M69171</link>
      <description>&lt;P&gt;Hi tamerj1, thank you for your response, but this gives quite different number.&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 10:46:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-rows-where-sum-is-less-than-20-filter-context-DAX-issue/m-p/2501785#M69171</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-05-09T10:46:54Z</dc:date>
    </item>
    <item>
      <title>Re: Count rows where sum is less than 20 filter context DAX issue</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-rows-where-sum-is-less-than-20-filter-context-DAX-issue/m-p/2501804#M69172</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Just now I saw your clarification to Rico.&lt;/P&gt;&lt;P&gt;You can try&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Asset&amp;lt;20h =
SUMX (
    SUMMARIZE (
        FILTER ( ByAsset, ByAsset[Branch] IN { "Naval Base", "Boddington" } ),
        ByAsset[Asset Number],
        ByAsset[Date]
    ),
    CALCULATE ( IF ( SUM ( ByAsset[Total hours] ) &amp;lt; 20, 1 ) )
)&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 09 May 2022 10:54:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-rows-where-sum-is-less-than-20-filter-context-DAX-issue/m-p/2501804#M69172</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-05-09T10:54:43Z</dc:date>
    </item>
    <item>
      <title>Re: Count rows where sum is less than 20 filter context DAX issue</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-rows-where-sum-is-less-than-20-filter-context-DAX-issue/m-p/2502758#M69222</link>
      <description>&lt;P&gt;Hi Rico, I got it to work by just summing them, thank you again for your assistance:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Asset&amp;lt;20h_All = 
VAR _TOTALHOURS_NAVALS =
SUMMARIZE (
Filter(ByAsset,ByAsset[Branch] in {"Naval Base"}),
ByAsset[Asset Number],
"Total Hours Navals", SUM ( ByAsset[Total hours] )
)
VAR _TOTALHOURS_BODDINGTON =
SUMMARIZE (
Filter(ByAsset,ByAsset[Branch] in {"Boddington"}),
ByAsset[Asset Number],
"Total Hours Bod", SUM ( ByAsset[Total hours] )
)
VAR _TOTALHOURS_PH =
SUMMARIZE (
Filter(ByAsset,ByAsset[Branch] in {"Port Hedland"}),
ByAsset[Asset Number],
"Total Hours PH", SUM ( ByAsset[Total hours] )
)
RETURN
COUNTAX ( FILTER ( _TOTALHOURS_NAVALS, [Total Hours Navals] &amp;lt; 20 ), [Asset Number] )+ COUNTAX ( FILTER ( _TOTALHOURS_BODDINGTON, [Total Hours Bod]&amp;lt; 20 ), [Asset Number] )
+COUNTAX ( FILTER ( _TOTALHOURS_PH, [Total Hours PH]&amp;lt; 20 ), [Asset Number] )&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 09 May 2022 17:42:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-rows-where-sum-is-less-than-20-filter-context-DAX-issue/m-p/2502758#M69222</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-05-09T17:42:32Z</dc:date>
    </item>
    <item>
      <title>Re: Count rows where sum is less than 20 filter context DAX issue</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-rows-where-sum-is-less-than-20-filter-context-DAX-issue/m-p/2502765#M69223</link>
      <description>&lt;P&gt;Thank you tamerj1,&amp;nbsp;&lt;BR /&gt;The number is off by sumx but summing up Rico logic works great, Thank you so much for your assistance , closing this thread now.&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 17:44:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-rows-where-sum-is-less-than-20-filter-context-DAX-issue/m-p/2502765#M69223</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-05-09T17:44:24Z</dc:date>
    </item>
  </channel>
</rss>

