<?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: mulitple counts not wanted, just count once in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/mulitple-counts-not-wanted-just-count-once/m-p/3546191#M136348</link>
    <description>&lt;P&gt;&lt;SPAN&gt;I see, my apologies for the misunderstanding. If you want to avoid counting the amount multiple times for repeated reporting dates, you can modify the DAX measure as follows:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;TotalAmountLatestCancellation =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUMX(&lt;BR /&gt;VALUES('FactTable'[Category]),&lt;BR /&gt;CALCULATE(&lt;BR /&gt;MAXX(&lt;BR /&gt;FILTER(&lt;BR /&gt;'FactTable',&lt;BR /&gt;'FactTable'[CancellationDate] = MAX('DateTable'[Date])&lt;BR /&gt;),&lt;BR /&gt;'FactTable'[Amount]&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here, I replaced LASTNONBLANK with MAXX. This change ensures that only the maximum amount for each category on the latest cancellation date is considered. This should prevent the multiplication of amounts for repeated reporting dates.&lt;/P&gt;&lt;P&gt;Please test this measure in your Power BI environment and adjust it according to your specific data model if needed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If this post&amp;nbsp;helps, then please consider&amp;nbsp;Accepting it as the solution&amp;nbsp;to help the other members find it more quickly.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;In case there is still a problem, please feel free and explain your issue in detail,&amp;nbsp;It will be my pleasure to assist you in any way I can.&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Nov 2023 07:25:00 GMT</pubDate>
    <dc:creator>123abc</dc:creator>
    <dc:date>2023-11-22T07:25:00Z</dc:date>
    <item>
      <title>mulitple counts not wanted, just count once</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/mulitple-counts-not-wanted-just-count-once/m-p/3541888#M136120</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I need some help with a DAX meassure to calculate the right values.&lt;/P&gt;&lt;P&gt;The date table is connected to the reporting date. The fact table is a full load dump by the report date. That means the fact are repeated month by month. To count the distinct value of the category is fine, but the category has a related amount. e.g category 1X!X! has 15 pcs. The amount of 15 pcs are multipled by the number of reporting date.&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 category has a cancelation date, but i don´t want to multiply each reporting month. I just want to count the latest amount (for the cancalation date, which is connected to the date table. Or the last date whre the cancalation date is recorded.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestion?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2023 08:13:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/mulitple-counts-not-wanted-just-count-once/m-p/3541888#M136120</guid>
      <dc:creator>ASS</dc:creator>
      <dc:date>2023-11-20T08:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: mulitple counts not wanted, just count once</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/mulitple-counts-not-wanted-just-count-once/m-p/3541960#M136125</link>
      <description>&lt;P&gt;It looks like you're working with DAX (Data Analysis Expressions) in Power BI or a similar tool and you want to create a measure that calculates the distinct count of a category, taking into account the cancellation date and only considering the latest amount for that category.&lt;/P&gt;&lt;P&gt;Assuming you have a fact table with columns like "Category," "Amount," and "CancellationDate," and a date table connected to the reporting date, here's a possible approach using DAX:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DistinctCountLatestAmount =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;MAXX(&lt;BR /&gt;VALUES('YourTable'[Category]),&lt;BR /&gt;CALCULATE(&lt;BR /&gt;COUNTROWS('YourTable'),&lt;BR /&gt;FILTER(&lt;BR /&gt;'YourTable',&lt;BR /&gt;'YourTable'[CancellationDate] = MAX('YourDateTable'[Date])&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This measure uses the CALCULATE function to create a context transition and then applies the MAXX function to iterate over the distinct values of the 'Category' column. For each category, it calculates the count of rows where the cancellation date matches the maximum date in the date table. The MAXX function then returns the maximum value of this count for all categories.&lt;/P&gt;&lt;P&gt;Make sure to replace 'YourTable' and 'YourDateTable' with the actual names of your tables. Adjust the column and table names in the DAX code to match your data model.&lt;/P&gt;&lt;P&gt;This measure should give you the distinct count of categories considering only the latest amount for each category based on the cancellation date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If this post&amp;nbsp;helps, then please consider&amp;nbsp;Accepting it as the solution&amp;nbsp;to help the other members find it more quickly.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;In case there is still a problem, please feel free and explain your issue in detail,&amp;nbsp;It will be my pleasure to assist you in any way I can.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2023 08:58:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/mulitple-counts-not-wanted-just-count-once/m-p/3541960#M136125</guid>
      <dc:creator>123abc</dc:creator>
      <dc:date>2023-11-20T08:58:08Z</dc:date>
    </item>
    <item>
      <title>Re: mulitple counts not wanted, just count once</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/mulitple-counts-not-wanted-just-count-once/m-p/3542011#M136129</link>
      <description>&lt;P&gt;Hi, thanks for reply, but the distinct count of the category is not the problem. The summarization over the repeated reporting dates of the amount needs to be solved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2023 09:24:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/mulitple-counts-not-wanted-just-count-once/m-p/3542011#M136129</guid>
      <dc:creator>ASS</dc:creator>
      <dc:date>2023-11-20T09:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: mulitple counts not wanted, just count once</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/mulitple-counts-not-wanted-just-count-once/m-p/3542033#M136133</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I see, I misunderstood your initial question. If you want to avoid the multiplication of the amount for each reporting date and only consider the latest cancellation date, you can modify the measure as follows:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;LatestAmount =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUMX(&lt;BR /&gt;VALUES(FactTable[Category]),&lt;BR /&gt;VAR LatestCancellationDate = CALCULATE(&lt;BR /&gt;MAX(FactTable[CancellationDate]),&lt;BR /&gt;ALLEXCEPT(FactTable, FactTable[Category])&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUMX(&lt;BR /&gt;FILTER(FactTable, FactTable[CancellationDate] = LatestCancellationDate),&lt;BR /&gt;FactTable[Amount]&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This modified measure introduces a variable (LatestCancellationDate) to calculate the latest cancellation date for each category. The ALLEXCEPT function is used to remove the context of all columns in the FactTable except the Category. Then, it calculates the sum of amounts for the rows where the cancellation date matches the latest cancellation date.&lt;/P&gt;&lt;P&gt;The outer SUMX then iterates through the distinct categories, and for each category, it calculates the sum of amounts based on the latest cancellation date.&lt;/P&gt;&lt;P&gt;This should give you the sum of amounts for each category, considering only the latest cancellation date, and avoiding multiplication for each reporting date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If this post&amp;nbsp;helps, then please consider&amp;nbsp;Accepting it as the solution&amp;nbsp;to help the other members find it more quickly.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;In case there is still a problem, please feel free and explain your issue in detail,&amp;nbsp;It will be my pleasure to assist you in any way I can.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2023 09:39:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/mulitple-counts-not-wanted-just-count-once/m-p/3542033#M136133</guid>
      <dc:creator>123abc</dc:creator>
      <dc:date>2023-11-20T09:39:04Z</dc:date>
    </item>
    <item>
      <title>Re: mulitple counts not wanted, just count once</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/mulitple-counts-not-wanted-just-count-once/m-p/3546191#M136348</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I see, my apologies for the misunderstanding. If you want to avoid counting the amount multiple times for repeated reporting dates, you can modify the DAX measure as follows:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;TotalAmountLatestCancellation =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUMX(&lt;BR /&gt;VALUES('FactTable'[Category]),&lt;BR /&gt;CALCULATE(&lt;BR /&gt;MAXX(&lt;BR /&gt;FILTER(&lt;BR /&gt;'FactTable',&lt;BR /&gt;'FactTable'[CancellationDate] = MAX('DateTable'[Date])&lt;BR /&gt;),&lt;BR /&gt;'FactTable'[Amount]&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here, I replaced LASTNONBLANK with MAXX. This change ensures that only the maximum amount for each category on the latest cancellation date is considered. This should prevent the multiplication of amounts for repeated reporting dates.&lt;/P&gt;&lt;P&gt;Please test this measure in your Power BI environment and adjust it according to your specific data model if needed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If this post&amp;nbsp;helps, then please consider&amp;nbsp;Accepting it as the solution&amp;nbsp;to help the other members find it more quickly.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;In case there is still a problem, please feel free and explain your issue in detail,&amp;nbsp;It will be my pleasure to assist you in any way I can.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 07:25:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/mulitple-counts-not-wanted-just-count-once/m-p/3546191#M136348</guid>
      <dc:creator>123abc</dc:creator>
      <dc:date>2023-11-22T07:25:00Z</dc:date>
    </item>
  </channel>
</rss>

