<?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: Matching Totals Once Using Filters in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matching-Totals-Once-Using-Filters/m-p/3682054#M143003</link>
    <description>&lt;P&gt;&lt;SPAN&gt;To achieve the desired result of showing the total only once for each unique match, you can use the DISTINCT function in DAX. This function ensures that only distinct values are considered in the calculation. Here's how you can modify your DAX measure:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Sum Project Not Billed Milestones =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUMX(&lt;BR /&gt;DISTINCT(AT_Projects[contractID]),&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUM(AT_ContractMilestones_NotBilled[amount]),&lt;BR /&gt;FILTER(&lt;BR /&gt;AT_ContractMilestones_NotBilled,&lt;BR /&gt;AT_ContractMilestones_NotBilled[contractID] = AT_Projects[contractID]&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;In this measure:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;SUMX iterates over each distinct contractID in the AT_Projects table.&lt;/LI&gt;&lt;LI&gt;DISTINCT function ensures that each contractID is considered only once.&lt;/LI&gt;&lt;LI&gt;CALCULATE is used to perform the filtering and calculation for each distinct contractID.&lt;/LI&gt;&lt;LI&gt;FILTER is applied to filter the AT_ContractMilestones_NotBilled table based on the current contractID being iterated.&lt;/LI&gt;&lt;LI&gt;SUM calculates the sum of the filtered amount for each contractID.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;This way, the total should only be shown once for each unique match, ensuring the correctness of the total at the bottom.&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>Tue, 06 Feb 2024 06:43:34 GMT</pubDate>
    <dc:creator>123abc</dc:creator>
    <dc:date>2024-02-06T06:43:34Z</dc:date>
    <item>
      <title>Matching Totals Once Using Filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matching-Totals-Once-Using-Filters/m-p/3680990#M142950</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a series of data which have a shared ID and I would like to show a total only once rather than matching to every line.&lt;/P&gt;&lt;P&gt;The following is the code I have and the result... does any one have a correct or better way of doing this ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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;Sum Project Not Billed Milestones = 
CALCULATE(
    SUM(AT_ContractMilestones_NotBilled[amount]),
    FILTER(
        AT_ContractMilestones_NotBilled,
        AT_ContractMilestones_NotBilled[contractID] = AT_Projects[contractID]
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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 above should only show £42.900.00 the first time its matched and no other times so the total at the bottom is correct.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There could be other matches through the data and those too should only be shown once.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks In Advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Terran&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 18:20:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matching-Totals-Once-Using-Filters/m-p/3680990#M142950</guid>
      <dc:creator>ccsnet</dc:creator>
      <dc:date>2024-02-05T18:20:08Z</dc:date>
    </item>
    <item>
      <title>Re: Matching Totals Once Using Filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matching-Totals-Once-Using-Filters/m-p/3682049#M143001</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="666697" data-lia-user-login="ccsnet" class="lia-mention lia-mention-user"&gt;ccsnet&lt;/a&gt;&amp;nbsp;usually, the best practice using Star schema is to show ID's based on some dimensions, like product id, or Customer ID.&lt;/P&gt;
&lt;P&gt;Choose your Customer ID from your dimension table and check results. Check &lt;A href="https://learn.microsoft.com/en-us/power-bi/guidance/star-schema" target="_blank"&gt;link&lt;/A&gt; for example&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 06:41:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matching-Totals-Once-Using-Filters/m-p/3682049#M143001</guid>
      <dc:creator>some_bih</dc:creator>
      <dc:date>2024-02-06T06:41:48Z</dc:date>
    </item>
    <item>
      <title>Re: Matching Totals Once Using Filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matching-Totals-Once-Using-Filters/m-p/3682054#M143003</link>
      <description>&lt;P&gt;&lt;SPAN&gt;To achieve the desired result of showing the total only once for each unique match, you can use the DISTINCT function in DAX. This function ensures that only distinct values are considered in the calculation. Here's how you can modify your DAX measure:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Sum Project Not Billed Milestones =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUMX(&lt;BR /&gt;DISTINCT(AT_Projects[contractID]),&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUM(AT_ContractMilestones_NotBilled[amount]),&lt;BR /&gt;FILTER(&lt;BR /&gt;AT_ContractMilestones_NotBilled,&lt;BR /&gt;AT_ContractMilestones_NotBilled[contractID] = AT_Projects[contractID]&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;In this measure:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;SUMX iterates over each distinct contractID in the AT_Projects table.&lt;/LI&gt;&lt;LI&gt;DISTINCT function ensures that each contractID is considered only once.&lt;/LI&gt;&lt;LI&gt;CALCULATE is used to perform the filtering and calculation for each distinct contractID.&lt;/LI&gt;&lt;LI&gt;FILTER is applied to filter the AT_ContractMilestones_NotBilled table based on the current contractID being iterated.&lt;/LI&gt;&lt;LI&gt;SUM calculates the sum of the filtered amount for each contractID.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;This way, the total should only be shown once for each unique match, ensuring the correctness of the total at the bottom.&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>Tue, 06 Feb 2024 06:43:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matching-Totals-Once-Using-Filters/m-p/3682054#M143003</guid>
      <dc:creator>123abc</dc:creator>
      <dc:date>2024-02-06T06:43:34Z</dc:date>
    </item>
    <item>
      <title>Re: Matching Totals Once Using Filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matching-Totals-Once-Using-Filters/m-p/3682074#M143004</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="666697" data-lia-user-login="ccsnet" class="lia-mention lia-mention-user"&gt;ccsnet&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to your description, here are my steps you can follow as a solution.&lt;/P&gt;
&lt;P&gt;(1) This is my test data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;(2) We can create a measure.&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sum Project Not Billed Milestones = 
CALCULATE(
    SUM(AT_ContractMilestones_NotBilled[amount]),
    FILTER(
        AT_ContractMilestones_NotBilled,
        AT_ContractMilestones_NotBilled[contractID] =MAX(AT_Projects[contractID])
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;(3) Then 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;If the above one can't help you get the desired result, please provide some&amp;nbsp;&lt;STRONG&gt;sample data&lt;/STRONG&gt;&amp;nbsp;in your tables (&lt;STRONG&gt;exclude&amp;nbsp;sensitive&amp;nbsp;data&lt;/STRONG&gt;) with&amp;nbsp;&lt;STRONG&gt;Text&lt;/STRONG&gt;&amp;nbsp;format and your&amp;nbsp;&lt;STRONG&gt;expected result&lt;/STRONG&gt;&amp;nbsp;with backend logic and special examples.&amp;nbsp;&lt;STRONG&gt;It is better&lt;/STRONG&gt;&amp;nbsp;if you can share a&amp;nbsp;&lt;STRONG&gt;simplified&lt;/STRONG&gt;&amp;nbsp;pbix file.&amp;nbsp;Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Neeko Tang&lt;/P&gt;
&lt;P&gt;If this post  &lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;EM&gt;Accept it as the solution &lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 06:48:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matching-Totals-Once-Using-Filters/m-p/3682074#M143004</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-06T06:48:02Z</dc:date>
    </item>
    <item>
      <title>Re: Matching Totals Once Using Filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matching-Totals-Once-Using-Filters/m-p/3682917#M143036</link>
      <description>&lt;P&gt;Thank you all - for now I have gone with ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is because SUMX did not want to work and repeated the same number all the way down however I will go back but assume I could get a couple of missed numbers for now.&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;Sum Project Billed Milestones = 
CALCULATE(
    SUM(Autotask_ContractMilestones_Billed[amount]),
    FILTER(
        DISTINCT(Autotask_ContractMilestones_Billed[contractID]),
        Autotask_ContractMilestones_Billed[contractID] = Autotask_Projects[contractID]
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will also have a look at the schema option which seems to be a good way forward too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;T&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2024 08:24:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matching-Totals-Once-Using-Filters/m-p/3682917#M143036</guid>
      <dc:creator>ccsnet</dc:creator>
      <dc:date>2024-02-07T08:24:26Z</dc:date>
    </item>
  </channel>
</rss>

