<?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: How to sum a rate from a dimension table only for the keys present in my fact table? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-a-rate-from-a-dimension-table-only-for-the-keys/m-p/4779640#M183050</link>
    <description>&lt;P&gt;thanks, selected value will not work. I need a ful;l row-context&lt;/P&gt;</description>
    <pubDate>Tue, 29 Jul 2025 09:17:05 GMT</pubDate>
    <dc:creator>jaryszek</dc:creator>
    <dc:date>2025-07-29T09:17:05Z</dc:date>
    <item>
      <title>How to sum a rate from a dimension table only for the keys present in my fact table?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-a-rate-from-a-dimension-table-only-for-the-keys/m-p/4778471#M183016</link>
      <description>&lt;P&gt;Hi Power BI Community,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I have a classic star schema model with a fact table and a dimension table. My dimension table includes a numeric rate/price field (DiscountPlanEffectivePrice) and a key called DateDiscountPlanMeterId. This key is also present in my fact table, and it's used for joining the two tables.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&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;In my matrix visual, I’m grouping by various topology fields (like region, offer, pricing model, etc.) from my fact table, and I want to display the sum of the unique DiscountPlanEffectivePrice values from the dimension table, but only for the keys that actually exist in the current filter context of my fact table.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;My goal is to:&lt;/P&gt;&lt;P&gt;Avoid summing all rates from the dimension, and&lt;/P&gt;&lt;P&gt;Avoid duplicating the same rate for every related fact row.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I’ve tried DAX measures like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sum of Effective Discount Prices =
SUMX (
    VALUES(Fct_EA_AmortizedCosts[DateDiscountPlanMeterId]),
    CALCULATE(
      SELECTEDVALUE(Dim_EA_AmortizedCosts_DiscountPlans[DiscountPlanEffectivePrice])
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;and also attempted using SUMMARIZE, but I’m either getting blank results or incorrect totals.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The relationship between the tables is active and based on DateDiscountPlanMeterId.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;How can I correctly sum only the unique rates from the dimension for keys that are present in my fact table’s current context?&lt;BR /&gt;Is there a better DAX pattern, or am I missing something in the way context or relationships should be handled for this scenario?&lt;/P&gt;&lt;P&gt;Any suggestions or guidance would be greatly appreciated!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;BR /&gt;Jacek&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jul 2025 10:52:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-a-rate-from-a-dimension-table-only-for-the-keys/m-p/4778471#M183016</guid>
      <dc:creator>jaryszek</dc:creator>
      <dc:date>2025-07-28T10:52:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum a rate from a dimension table only for the keys present in my fact table?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-a-rate-from-a-dimension-table-only-for-the-keys/m-p/4778490#M183018</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="107617" data-lia-user-login="jaryszek" class="lia-mention lia-mention-user"&gt;jaryszek&lt;/a&gt;&amp;nbsp;, Please try below DAX&amp;nbsp; and share your inputs:&lt;/P&gt;&lt;P&gt;Sum of Unique Discount Prices =&lt;BR /&gt;SUMX(&lt;BR /&gt;VALUES(Fct_EA_AmortizedCosts[DateDiscountPlanMeterId]),&lt;BR /&gt;RELATED(Dim_EA_AmortizedCosts_DiscountPlans[DiscountPlanEffectivePrice])&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Azad&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jul 2025 11:13:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-a-rate-from-a-dimension-table-only-for-the-keys/m-p/4778490#M183018</guid>
      <dc:creator>Azadsingh</dc:creator>
      <dc:date>2025-07-28T11:13:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum a rate from a dimension table only for the keys present in my fact table?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-a-rate-from-a-dimension-table-only-for-the-keys/m-p/4778656#M183029</link>
      <description>&lt;P&gt;Thanks.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;This is not working:&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;Best,&lt;BR /&gt;Jacek&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jul 2025 13:11:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-a-rate-from-a-dimension-table-only-for-the-keys/m-p/4778656#M183029</guid>
      <dc:creator>jaryszek</dc:creator>
      <dc:date>2025-07-28T13:11:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum a rate from a dimension table only for the keys present in my fact table?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-a-rate-from-a-dimension-table-only-for-the-keys/m-p/4778664#M183030</link>
      <description>&lt;P&gt;You could try&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sum of Effective Discount Prices =
SUMX (
    SUMMARIZE (
        Fct_EA_AmortizedCosts,
        Dim_EA_AmortizedCosts_DiscountPlans[DiscountPlanEffectivePrice]
    ),
    Dim_EA_AmortizedCosts_DiscountPlans[DiscountPlanEffectivePrice]
)
&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 28 Jul 2025 13:17:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-a-rate-from-a-dimension-table-only-for-the-keys/m-p/4778664#M183030</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2025-07-28T13:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum a rate from a dimension table only for the keys present in my fact table?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-a-rate-from-a-dimension-table-only-for-the-keys/m-p/4778670#M183031</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="107617" data-lia-user-login="jaryszek" class="lia-mention lia-mention-user"&gt;jaryszek&lt;/a&gt;&amp;nbsp;, Please fix the column name in the error or try this&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sum of Effective Discount Prices =SUMX (VALUES(Fct_EA_AmortizedCosts[DateDiscountPlanMeterId]),CALCULATE(&lt;BR /&gt;SELECTEDVALUE(Dim_EA_AmortizedCosts_DiscountPlans[DiscountPlanEffectivePrice])))&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jul 2025 13:22:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-a-rate-from-a-dimension-table-only-for-the-keys/m-p/4778670#M183031</guid>
      <dc:creator>Azadsingh</dc:creator>
      <dc:date>2025-07-28T13:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum a rate from a dimension table only for the keys present in my fact table?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-a-rate-from-a-dimension-table-only-for-the-keys/m-p/4778851#M183033</link>
      <description>&lt;P&gt;Hello &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="107617" data-lia-user-login="jaryszek" class="lia-mention lia-mention-user"&gt;jaryszek&lt;/a&gt;, &lt;BR /&gt;Thank you for reaching out to the Microsoft Fabric Community Forum.&lt;BR /&gt;&lt;BR /&gt;I have reproduced your scenario in Power BI Desktop using a sample dataset based on the details you provided. I was able to achieve the expected output as per your requirement.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;I used the following DAX measure to address your need:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sum of Effective Discount Prices =

CALCULATE(

    SUMX(

        DISTINCT('Dim_EA_AmortizedCosts_DiscountPlans'[DateDiscountPlanMeterId]),

        CALCULATE(

            MAX('Dim_EA_AmortizedCosts_DiscountPlans'[DiscountPlanEffectivePrice])

        )
    ),

    FILTER(

        'Dim_EA_AmortizedCosts_DiscountPlans',

        'Dim_EA_AmortizedCosts_DiscountPlans'[DateDiscountPlanMeterId] IN VALUES('Fct_EA_AmortizedCosts'[DateDiscountPlanMeterId])

    )
)&lt;/LI-CODE&gt;
&lt;P&gt;This measure ensures that only unique rates for keys present in the fact table are summed, avoiding duplication and including only the relevant context.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Expected Output:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;This matches your goal of avoiding summation of all rates and preventing duplication. For your reference, I have attached a &lt;STRONG&gt;.pbix file&lt;/STRONG&gt; containing the reproduced scenario and the working solution. You can download it, explore the model, and adjust it with your actual data.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;If you have any further questions, please don't hesitate to contact us through the community. We are happy to assist you.&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Ganesh singamshetty.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jul 2025 15:14:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-a-rate-from-a-dimension-table-only-for-the-keys/m-p/4778851#M183033</guid>
      <dc:creator>v-ssriganesh</dc:creator>
      <dc:date>2025-07-28T15:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum a rate from a dimension table only for the keys present in my fact table?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-a-rate-from-a-dimension-table-only-for-the-keys/m-p/4779640#M183050</link>
      <description>&lt;P&gt;thanks, selected value will not work. I need a ful;l row-context&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jul 2025 09:17:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-a-rate-from-a-dimension-table-only-for-the-keys/m-p/4779640#M183050</guid>
      <dc:creator>jaryszek</dc:creator>
      <dc:date>2025-07-29T09:17:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum a rate from a dimension table only for the keys present in my fact table?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-a-rate-from-a-dimension-table-only-for-the-keys/m-p/4779940#M183059</link>
      <description>&lt;P&gt;&lt;FONT color="#000000"&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="107617" data-lia-user-login="jaryszek" class="lia-mention lia-mention-user"&gt;jaryszek&lt;/a&gt;,&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Great question — this is a common scenario when working with star schemas in Power BI.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;You're on the right track with wanting to sum &lt;EM&gt;only&lt;/EM&gt; the unique DiscountPlanEffectivePrice values from your dimension table (Dim_EA_AmortizedCosts_DiscountPlans) — and &lt;EM&gt;only&lt;/EM&gt; for the DateDiscountPlanMeterId values that are present in the current filter context of your fact table (Fct_EA_AmortizedCosts).&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;The challenge arises because using a simple SUM or even SUMX can inadvertently aggregate more than you intend — either repeating prices for each fact row, or including dimension rows that aren’t relevant in the current visual.&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;H3&gt;&lt;FONT color="#000000"&gt;Recommended Approach&lt;/FONT&gt;&lt;/H3&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Here’s a robust DAX measure pattern to achieve your goal:&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;Sum of Effective Discount Prices :=&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;SUMX(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;VALUES(Fct_EA_AmortizedCosts[DateDiscountPlanMeterId]),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;CALCULATE(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;MAX(Dim_EA_AmortizedCosts_DiscountPlans[DiscountPlanEffectivePrice])&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;VALUES(Fct_EA_AmortizedCosts[DateDiscountPlanMeterId]):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;This gets the &lt;STRONG&gt;distinct keys&lt;/STRONG&gt; from the fact table within the current visual/filter context. This ensures you’re working only with what's visible or filtered.&lt;/FONT&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;CALCULATE(MAX(...)):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;Inside SUMX, we retrieve the single DiscountPlanEffectivePrice from the dimension table per key.&lt;/FONT&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;If each key maps to a unique price (as expected in your scenario), MAX works fine and avoids errors from SELECTEDVALUE when there are unexpected duplicates.&lt;/FONT&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;SUMX(...):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;Sums only those prices associated with keys that exist in the filtered fact table — no duplication or unwanted dimension rows.&lt;/FONT&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;H3&gt;&lt;FONT color="#000000"&gt;Optional: Use SELECTEDVALUE if Confident in Data Uniqueness&lt;/FONT&gt;&lt;/H3&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;If you're certain that each DateDiscountPlanMeterId has exactly one corresponding price in the dimension table, you can also use:&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Sum of Effective Discount Prices :=&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;SUMX(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;VALUES(Fct_EA_AmortizedCosts[DateDiscountPlanMeterId]),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;CALCULATE(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;SELECTEDVALUE(Dim_EA_AmortizedCosts_DiscountPlans[DiscountPlanEffectivePrice])&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;Hope this helps! Hit that like button and mark it as solution.&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;&lt;STRONG&gt;Best Regards,&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;&lt;EM&gt;Jainesh Poojara | Power BI Developer&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jul 2025 12:28:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-sum-a-rate-from-a-dimension-table-only-for-the-keys/m-p/4779940#M183059</guid>
      <dc:creator>jaineshp</dc:creator>
      <dc:date>2025-07-29T12:28:59Z</dc:date>
    </item>
  </channel>
</rss>

