<?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: Power BI - issue with count in Pie Chart in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Power-BI-issue-with-count-in-Pie-Chart/m-p/4003413#M156175</link>
    <description>&lt;P&gt;Thanks for the reply from &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="691715" data-lia-user-login="Shivu-2000" class="lia-mention lia-mention-user"&gt;Shivu-2000&lt;/a&gt;&amp;nbsp;, please allow me to provide another insight:&amp;nbsp;&lt;BR /&gt;Hi&amp;nbsp; &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="619982" data-lia-user-login="andi2333" class="lia-mention lia-mention-user"&gt;andi2333&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I created some data:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;You can try the following measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure =
var _table=
FILTER(
    ALL('StuckOrders since 2024'),[date]=MAXX(ALL('StuckOrders since 2024'),[date]))
var _table2=
SUMMARIZE(
    _table,[Ordernumber],[Error])
return
COUNTX(
    FILTER(
        _table2,
        [Error]=MAX('StuckOrders since 2024'[Error])),[Ordernumber])&lt;/LI-CODE&gt;
&lt;P&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;Best Regards,&lt;/P&gt;
&lt;P&gt;Liu Yang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;Accept it as the solution&lt;/EM&gt; to help the other members find it more quickly&lt;/P&gt;</description>
    <pubDate>Fri, 21 Jun 2024 06:52:33 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-06-21T06:52:33Z</dc:date>
    <item>
      <title>Power BI - issue with count in Pie Chart</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Power-BI-issue-with-count-in-Pie-Chart/m-p/4001416#M155956</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a seemingly simple problem which I cannot solve for whatever reason. I have a file which summarizes "stuck" orders in our supply chain with an error code on a daily level. So the file looks like this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Ordernumber&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Error&lt;/P&gt;&lt;P&gt;17.06&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;000001&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Article Master Data&lt;/P&gt;&lt;P&gt;17.06&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;000002&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Customer Master Data&lt;/P&gt;&lt;P&gt;18.06&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;000001&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Article Master Data&lt;/P&gt;&lt;P&gt;18.06&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;000003&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Recipe Data&lt;/P&gt;&lt;P&gt;19.06&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;000003&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Recipe Data&lt;/P&gt;&lt;P&gt;etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created a measure to calculate the number of stuck orders of "today".&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;_openTicketsToday = 
VAR _maxDate = MAX('StuckOrders since 2024'[Date])
RETURN
CALCULATE(
    DISTINCTCOUNT('StuckOrders since 2024'[ORDERNUMBER])+0,
    FILTER('StuckOrders since 2024','StuckOrders since 2024'[Date]=_maxDate 
))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, the measure standalone works accurate, but when I combine the measure into a pie chart with "Error", I get some super-weird values. Power BI supposedly then counts rows which are not attached to this measure, and I dont know how to fix this.&lt;/P&gt;&lt;P&gt;Thanks for your support!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2024 07:52:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Power-BI-issue-with-count-in-Pie-Chart/m-p/4001416#M155956</guid>
      <dc:creator>andi2333</dc:creator>
      <dc:date>2024-06-20T07:52:11Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI - issue with count in Pie Chart</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Power-BI-issue-with-count-in-Pie-Chart/m-p/4001570#M155957</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="619982" data-lia-user-login="andi2333" class="lia-mention lia-mention-user"&gt;andi2333&lt;/a&gt;,&lt;BR /&gt;You are facing this problem because:&lt;/P&gt;&lt;P&gt;Your _openTicketsToday measure specifically filters for orders on the current date using FILTER('StuckOrders since 2024','StuckOrders since 2024'[Date]=_maxDate). However, when you place this measure into a pie chart with "Error," Power BI applies an additional context filter based on the selected error slices in the chart. This can lead to unexpected results because the measure's filter might not align with the chart's filter.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;To solve so you could eithe use the:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1. ALLSELECTED:&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;_openTicketsToday =&lt;BR /&gt;VAR _maxDate = MAX('StuckOrders since 2024'[Date])&lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE(&lt;BR /&gt;DISTINCTCOUNT('StuckOrders since 2024'[ORDERNUMBER])+0,&lt;BR /&gt;ALLSELECTED('StuckOrders since 2024'), // Consider all selected filters&lt;BR /&gt;'StuckOrders since 2024'[Date]=_maxDate // Filter for today's date&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2. Using DAX Filters in the Visualization:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;This approach uses the built-in Power BI filtering options to achieve the desired outcome:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Drag "Date" and "Error" fields to the "Fields" pane in your pie chart.&lt;/LI&gt;&lt;LI&gt;In the "Filters" pane, set a filter on the "Date" field to be equal to today's date. This ensures only data for today is displayed.&lt;BR /&gt;&lt;BR /&gt;&lt;U&gt;&lt;STRONG&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/STRONG&gt;&lt;/U&gt;&lt;BR /&gt;&lt;U&gt;&lt;STRONG&gt;Happy to help!&lt;/STRONG&gt;&lt;/U&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2024 09:14:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Power-BI-issue-with-count-in-Pie-Chart/m-p/4001570#M155957</guid>
      <dc:creator>Shivu-2000</dc:creator>
      <dc:date>2024-06-20T09:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI - issue with count in Pie Chart</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Power-BI-issue-with-count-in-Pie-Chart/m-p/4003413#M156175</link>
      <description>&lt;P&gt;Thanks for the reply from &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="691715" data-lia-user-login="Shivu-2000" class="lia-mention lia-mention-user"&gt;Shivu-2000&lt;/a&gt;&amp;nbsp;, please allow me to provide another insight:&amp;nbsp;&lt;BR /&gt;Hi&amp;nbsp; &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="619982" data-lia-user-login="andi2333" class="lia-mention lia-mention-user"&gt;andi2333&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I created some data:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;You can try the following measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure =
var _table=
FILTER(
    ALL('StuckOrders since 2024'),[date]=MAXX(ALL('StuckOrders since 2024'),[date]))
var _table2=
SUMMARIZE(
    _table,[Ordernumber],[Error])
return
COUNTX(
    FILTER(
        _table2,
        [Error]=MAX('StuckOrders since 2024'[Error])),[Ordernumber])&lt;/LI-CODE&gt;
&lt;P&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;Best Regards,&lt;/P&gt;
&lt;P&gt;Liu Yang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;Accept it as the solution&lt;/EM&gt; to help the other members find it more quickly&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2024 06:52:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Power-BI-issue-with-count-in-Pie-Chart/m-p/4003413#M156175</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-06-21T06:52:33Z</dc:date>
    </item>
  </channel>
</rss>

