<?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: performing filter and aggregate function on dataset before applying TOPN in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/performing-filter-and-aggregate-function-on-dataset-before/m-p/5176893#M187916</link>
    <description>&lt;P&gt;Many thanks to both Juan-Power-Bi and cengizhanarslan, both of their solutions worked for me.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 02 May 2026 18:13:24 GMT</pubDate>
    <dc:creator>onefish</dc:creator>
    <dc:date>2026-05-02T18:13:24Z</dc:date>
    <item>
      <title>performing filter and aggregate function on dataset before applying TOPN</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/performing-filter-and-aggregate-function-on-dataset-before/m-p/5157460#M187836</link>
      <description>&lt;P&gt;I have a table where information is logged individually. Before I use TOPN function, I need to filter the table for a condition (Status = "Available"), then do a group by (Sum count of unique ID by fruit) and then use the TOPN function. This would be my approach using SQL anyway. I would appreciate any tips on how to complete this task in DAX. If it matters, I do a have a slicer referencing a column not displayed here, but I've managed to get my other visuals to be responsive to the slicer appropiately. Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Original Table&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Unique_ID&lt;/TD&gt;&lt;TD&gt;Status&lt;/TD&gt;&lt;TD&gt;Fruit&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Available&lt;/TD&gt;&lt;TD&gt;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t;TR&gt;&lt;TD&gt;13&lt;/TD&gt;&lt;TD&gt;Discontinued&lt;/TD&gt;&lt;TD&gt;Peach&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;14&lt;/TD&gt;&lt;TD&gt;Available&lt;/TD&gt;&lt;TD&gt;Peach&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;Available&lt;/TD&gt;&lt;TD&gt;Peach&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expected results:&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Fruit&lt;/TD&gt;&lt;TD&gt;Count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Apple&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Pear&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Peach&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Apr 2026 04:28:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/performing-filter-and-aggregate-function-on-dataset-before/m-p/5157460#M187836</guid>
      <dc:creator>onefish</dc:creator>
      <dc:date>2026-04-24T04:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: performing filter and aggregate function on dataset before applying TOPN</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/performing-filter-and-aggregate-function-on-dataset-before/m-p/5158106#M187840</link>
      <description>&lt;P&gt;This is actually pretty straightforward in DAX. You just need a measure that filters for "Available" before counting, then use that measure in a visual with Fruit on the rows and a Top N visual-level filter applied.&lt;BR /&gt;First, create this measure:&lt;BR /&gt;daxAvailable Count =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;DISTINCTCOUNT('Table'[Unique_ID]),&lt;BR /&gt;'Table'[Status] = "Available"&lt;BR /&gt;)&lt;BR /&gt;Then put Fruit in your visual's rows and drop this measure in as the value. The grouping happens automatically since Fruit is in the visual context.&lt;BR /&gt;For the Top N part, add a visual-level filter on Fruit, set it to "Top N" by your Available Count measure, and set N to however many you want. That gives you exactly the SQL equivalent of filter → group by → TOPN.&lt;BR /&gt;Your slicer should also work fine with this since CALCULATE respects the existing filter context from slicers.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Apr 2026 19:51:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/performing-filter-and-aggregate-function-on-dataset-before/m-p/5158106#M187840</guid>
      <dc:creator>Juan-Power-bi</dc:creator>
      <dc:date>2026-04-24T19:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: performing filter and aggregate function on dataset before applying TOPN</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/performing-filter-and-aggregate-function-on-dataset-before/m-p/5158339#M187848</link>
      <description>&lt;P&gt;Please try the measure below:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Available Count =
CALCULATE (
    DISTINCTCOUNT ( Table1[Unique_ID] ),
    Table1[Status] = "Available"
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Place Fruit in the Rows field of a table visual and this measure as the value. Then apply TOPN by adding a visual-level Top N filter: Filters on this visual → Available Count → Filter type: Top N → Show items: Top 3 → By value: Available Count → Apply filter.&lt;/P&gt;</description>
      <pubDate>Sat, 25 Apr 2026 11:47:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/performing-filter-and-aggregate-function-on-dataset-before/m-p/5158339#M187848</guid>
      <dc:creator>cengizhanarslan</dc:creator>
      <dc:date>2026-04-25T11:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: performing filter and aggregate function on dataset before applying TOPN</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/performing-filter-and-aggregate-function-on-dataset-before/m-p/5159165#M187866</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1585575" data-lia-user-login="onefish" class="lia-mention lia-mention-user"&gt;onefish&lt;/a&gt;,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for posting your query in the Microsoft Fabric Community Forum, and thanks to the&amp;nbsp;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1292787" data-lia-user-login="cengizhanarslan" class="lia-mention lia-mention-user"&gt;cengizhanarslan&lt;/a&gt;&amp;nbsp;for&amp;nbsp;sharing valuable insights.&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Could you please confirm if your issue has been resolved using the suggested approach? This will help other community members facing similar scenarios.&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Apr 2026 11:04:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/performing-filter-and-aggregate-function-on-dataset-before/m-p/5159165#M187866</guid>
      <dc:creator>v-shchada-msft</dc:creator>
      <dc:date>2026-04-27T11:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: performing filter and aggregate function on dataset before applying TOPN</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/performing-filter-and-aggregate-function-on-dataset-before/m-p/5176168#M187887</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1585575" data-lia-user-login="onefish" class="lia-mention lia-mention-user"&gt;onefish&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;Just checking in to see if your issue has been resolved. If you’re still facing any problems, please feel free to reach out and we’ll be happy to assist further.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Apr 2026 10:40:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/performing-filter-and-aggregate-function-on-dataset-before/m-p/5176168#M187887</guid>
      <dc:creator>v-shchada-msft</dc:creator>
      <dc:date>2026-04-30T10:40:36Z</dc:date>
    </item>
    <item>
      <title>Re: performing filter and aggregate function on dataset before applying TOPN</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/performing-filter-and-aggregate-function-on-dataset-before/m-p/5176893#M187916</link>
      <description>&lt;P&gt;Many thanks to both Juan-Power-Bi and cengizhanarslan, both of their solutions worked for me.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 02 May 2026 18:13:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/performing-filter-and-aggregate-function-on-dataset-before/m-p/5176893#M187916</guid>
      <dc:creator>onefish</dc:creator>
      <dc:date>2026-05-02T18:13:24Z</dc:date>
    </item>
  </channel>
</rss>

