<?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: Measure to aggregate a count of objects meeting two criteria in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-aggregate-a-count-of-objects-meeting-two-criteria/m-p/4281866#M169927</link>
    <description>&lt;P&gt;Thanks Zhu, I just tried your proposed measure and it does work, except for the case when a user applies a slicer on the pivot table against other fields in the Objects table in order to limit the population of Objects to be considered, for example by its geographic location.&lt;/P&gt;&lt;P&gt;Is there a way to modify this measure so that the context of filters applied on the pivot chart against the Objects table are also considered?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;</description>
    <pubDate>Wed, 13 Nov 2024 13:50:10 GMT</pubDate>
    <dc:creator>SteveM123</dc:creator>
    <dc:date>2024-11-13T13:50:10Z</dc:date>
    <item>
      <title>Measure to aggregate a count of objects meeting two criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-aggregate-a-count-of-objects-meeting-two-criteria/m-p/4267320#M169173</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a Calendar table with a dates field and an Objects table, the Objects table includes a column with a 'born on date' and a status field for 'active' or 'inactive'. I would like a measure that cycles through every Calendar date within a time span selected by a slicer and aggregates a count of units that have a 'born on date' falling within that selected time span and that also has a Object status = "active"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 18:44:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-aggregate-a-count-of-objects-meeting-two-criteria/m-p/4267320#M169173</guid>
      <dc:creator>SteveM123</dc:creator>
      <dc:date>2024-11-01T18:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to aggregate a count of objects meeting two criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-aggregate-a-count-of-objects-meeting-two-criteria/m-p/4267353#M169179</link>
      <description>&lt;P&gt;hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="834708" data-lia-user-login="SteveM123" class="lia-mention lia-mention-user"&gt;SteveM123&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;try to:&lt;/P&gt;
&lt;P&gt;1. relate the calendar table and objects table.&lt;/P&gt;
&lt;P&gt;2. plot the slicer with calendar[date]&lt;/P&gt;
&lt;P&gt;3.plot a measure like:&lt;/P&gt;
&lt;P&gt;measure =&lt;/P&gt;
&lt;P&gt;COUNTROWS(&lt;/P&gt;
&lt;P&gt;&amp;nbsp; FILTER(objects,&amp;nbsp;objects[status]="active")&lt;/P&gt;
&lt;P&gt;)&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 19:40:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-aggregate-a-count-of-objects-meeting-two-criteria/m-p/4267353#M169179</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2024-11-01T19:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to aggregate a count of objects meeting two criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-aggregate-a-count-of-objects-meeting-two-criteria/m-p/4267373#M169184</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks for that reply, but in my attempt to be succinct, I made a mistake in describing the scenario. A unit can be currently active, or it can be currently&amp;nbsp; inactive, but even a unit that is inactive today, was active at some earlier point in time. As such, my Objects table has both a 'born on date', call it a 'start date' and a 'decommissioned date' , lets call it an 'end date'&lt;/P&gt;&lt;P&gt;So I should have stated that the goal is to aggregate the number of Objects in the Objects table that were active for the slicer selected period, including objects that may be inactive today, but were active back during the period selected by the slicer.&lt;/P&gt;&lt;P&gt;So perhaps I need a measure that cycles through all calendar dates within the slicer selected period and for each of those dates, loops through the Objects table and aggregates a count of objects in the object table that have a 'start date' before the calendar date and either no 'end date' or an 'end date that is later than the current calendar date being evaluated. I would then divide that aggregated number by the number of days in the slicer selected peroid to obtain an effective count of operating units for the period which may or may not be a whole number&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 20:14:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-aggregate-a-count-of-objects-meeting-two-criteria/m-p/4267373#M169184</guid>
      <dc:creator>SteveM123</dc:creator>
      <dc:date>2024-11-01T20:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to aggregate a count of objects meeting two criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-aggregate-a-count-of-objects-meeting-two-criteria/m-p/4268829#M169266</link>
      <description>&lt;P&gt;Thanks for the reply from&amp;nbsp;FreemanZ.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="834708" data-lia-user-login="SteveM123" class="lia-mention lia-mention-user"&gt;SteveM123&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on your description, l created simple test data:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Create a measure:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = 
VAR _startdate=MIN('Calendar'[Date])
VAR _enddate=MAX('Calendar'[Date])
VAR _interval=DATEDIFF(_startdate,_enddate,DAY)
RETURN
IF(MAX('Objects'[Start Date])&amp;lt;=_enddate&amp;amp;&amp;amp;OR(MAX('Objects'[End Date])&amp;gt;_startdate,MAX('Objects'[End Date])=BLANK()),DIVIDE(CALCULATE(COUNTROWS('Objects')),_interval))
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The result is as follows:&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;Zhu&lt;BR /&gt;Community Support Team&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;I&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/I&gt;, then please consider&amp;nbsp;&lt;I&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/I&gt;&amp;nbsp;&amp;nbsp;to help the other members find it more quickly.&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2024 08:47:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-aggregate-a-count-of-objects-meeting-two-criteria/m-p/4268829#M169266</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-04T08:47:08Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to aggregate a count of objects meeting two criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-aggregate-a-count-of-objects-meeting-two-criteria/m-p/4281866#M169927</link>
      <description>&lt;P&gt;Thanks Zhu, I just tried your proposed measure and it does work, except for the case when a user applies a slicer on the pivot table against other fields in the Objects table in order to limit the population of Objects to be considered, for example by its geographic location.&lt;/P&gt;&lt;P&gt;Is there a way to modify this measure so that the context of filters applied on the pivot chart against the Objects table are also considered?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 13:50:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-aggregate-a-count-of-objects-meeting-two-criteria/m-p/4281866#M169927</guid>
      <dc:creator>SteveM123</dc:creator>
      <dc:date>2024-11-13T13:50:10Z</dc:date>
    </item>
  </channel>
</rss>

