<?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: Price Effect - incorrect Sumx calculations when applying several filters from different tables in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Price-Effect-incorrect-Sumx-calculations-when-applying-several/m-p/3980645#M154345</link>
    <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="751649" data-lia-user-login="Eb50" class="lia-mention lia-mention-user"&gt;Eb50&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;share sample file with input and expected output for possible solution.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Jun 2024 17:59:00 GMT</pubDate>
    <dc:creator>some_bih</dc:creator>
    <dc:date>2024-06-07T17:59:00Z</dc:date>
    <item>
      <title>Price Effect - incorrect Sumx calculations when applying several filters from different tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Price-Effect-incorrect-Sumx-calculations-when-applying-several/m-p/3958688#M153626</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I looked on the forum before posting but I coudn't get a resultat that works for my situation. I'd gladly use your help on this because I have been stuck for almost a month now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to calculate a price effect on PowerPivot in a measure but the result isn't always correct. When displayed in a Pivot Table with only the products it gives me a result that seem to be correct. The calculation on each product row is correct, and the total is an addition of all my results. It look like this :&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;&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;However, whenever I want to add a filter on the customer (customer category), the total is still correct but not the detail by customer :&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;To explain a bit further how everything is tied together, the data model has 4 tables that look like this :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;The relations are [Product]Product ID --&amp;gt; Sales[Product ID],&amp;nbsp;[customer]Customer ID --&amp;gt; Sales[Customer_ID], and [calendar]Date --&amp;gt; [Sales]Date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Inside the model I have a few calculations :&lt;/P&gt;&lt;P&gt;The first one calculate a turnover without the litigation amount (when there is no cause, there is no litigation with the customer)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;!--  StartFragment   --&gt;&lt;SPAN class=""&gt;Gross turnover:=&lt;/SPAN&gt;&lt;SPAN class=""&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;SUM&lt;/SPAN&gt;&lt;SPAN class=""&gt;(Sales[Turnover]);Sales[Litigation cause]=&lt;/SPAN&gt;&lt;SPAN class=""&gt;""&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;!--  EndFragment   --&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;The seconde one is the same but give the Last Year result :&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;!--  StartFragment   --&gt;&lt;SPAN class=""&gt;Gross turnover_LY:=&lt;/SPAN&gt;&lt;SPAN class=""&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;[Gross turnover];&lt;/SPAN&gt;&lt;SPAN class=""&gt;SAMEPERIODLASTYEAR&lt;/SPAN&gt;&lt;SPAN class=""&gt;('Calendar'[Date])&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;!--  EndFragment   --&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then, I do exactly the same for the quantity :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;!--  StartFragment   --&gt;&lt;SPAN class=""&gt;Quantity_wo_litigation:=&lt;/SPAN&gt;&lt;SPAN class=""&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;SUM&lt;/SPAN&gt;&lt;SPAN class=""&gt;(Sales[Quantity]);Sales[Litigation cause]=&lt;/SPAN&gt;&lt;SPAN class=""&gt;""&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;!--  EndFragment   --&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;!--  StartFragment   --&gt;Quantity_wo_litigation_LY:=&lt;SPAN class=""&gt;CALCULATE&lt;/SPAN&gt;([Quantity_wo_litigation];&lt;SPAN class=""&gt;SAMEPERIODLASTYEAR&lt;/SPAN&gt;('Calendar'[Date]))&lt;!--  EndFragment   --&gt;&lt;BR /&gt;&lt;!--  EndFragment   --&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;With those 4 measure, I'm able to compute the € per unit sold :&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;!--  StartFragment   --&gt;&lt;SPAN class=""&gt;€/Unit_Sold:=[Gross turnover]/[Quantity_wo_litigation]&lt;/SPAN&gt;&lt;!--  EndFragment   --&gt;&lt;/P&gt;&lt;P&gt;&lt;!--  StartFragment   --&gt;&lt;SPAN class=""&gt;€/Unit_Sold_LY:=[Gross turnover_LY]/[Quantity_wo_litigation_LY]&lt;/SPAN&gt;&lt;!--  EndFragment   --&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And in the end, here's my calculation that I have a problem with :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;!--  StartFragment   --&gt;&lt;SPAN class=""&gt;Price effect:=&lt;/SPAN&gt;&lt;SPAN class=""&gt;SUMX&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;VALUES&lt;/SPAN&gt;&lt;SPAN class=""&gt;('Product'[Product_ID]);&lt;/SPAN&gt;&lt;SPAN class=""&gt;IF&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;OR&lt;/SPAN&gt;&lt;SPAN class=""&gt;([€/Unit_Sold]=0;[€/Unit_Sold_LY]=0);0;([€/Unit_Sold]-[€/Unit_Sold_LY])*[Quantity_wo_litigation]))&lt;/SPAN&gt;&lt;!--  EndFragment   --&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;I think there is probably something that I still don't really understand about Row context, filter context and context transition, That prevents me from achieving what I want ...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;I have to add that in the sales table, an article can be sold at 2 different customers for a different price. Thus I'm even starting to doubt that VALUES(&lt;SPAN class=""&gt;VALUES&lt;/SPAN&gt;('Product'[Product_ID])) even gives me a correct answer when I don't apply a filter on customer.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the link to the excel file if you want to take a closer look :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://1drv.ms/x/s!Aig7MvvpS7QOuxRAhb3Kt2n98bwu?e=Aa7ChL" target="_self"&gt;Price_effect&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2024 17:24:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Price-Effect-incorrect-Sumx-calculations-when-applying-several/m-p/3958688#M153626</guid>
      <dc:creator>Eb50</dc:creator>
      <dc:date>2024-05-29T17:24:03Z</dc:date>
    </item>
    <item>
      <title>Re: Price Effect - incorrect Sumx calculations when applying several filters from different tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Price-Effect-incorrect-Sumx-calculations-when-applying-several/m-p/3959919#M153665</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="751649" data-lia-user-login="Eb50" class="lia-mention lia-mention-user"&gt;Eb50&lt;/a&gt;&amp;nbsp;the issue is measure Price_effect?&lt;/P&gt;
&lt;P&gt;When you see&amp;nbsp; definition below there is "try to filter another measure" (part&amp;nbsp;&amp;nbsp;[&lt;SPAN&gt;€/Unit_Sold] or[€/Unit_Sold_LY] or [ Quantity_wo_litigation]).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In DAX this is not "easy" as measures are not columns.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This part should be rewritten to grasp DAX features. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Think what is your calculation logic / share it with input and expected output for possible solution.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;MEASURE&lt;/SPAN&gt; &lt;SPAN&gt;Sales[Price effect]&lt;/SPAN&gt; = &lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;VALUES&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Product'[Product_ID]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;,&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;OR&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;[€/Unit_Sold]&lt;/SPAN&gt;=&lt;SPAN&gt;0&lt;/SPAN&gt;,&lt;SPAN&gt;[€/Unit_Sold_LY]&lt;/SPAN&gt;=&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;,&lt;SPAN&gt;0&lt;/SPAN&gt;,&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;[€/Unit_Sold]&lt;/SPAN&gt;-&lt;SPAN&gt;[€/Unit_Sold_LY]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;*&lt;SPAN&gt;[Quantity_wo_litigation]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2024 06:45:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Price-Effect-incorrect-Sumx-calculations-when-applying-several/m-p/3959919#M153665</guid>
      <dc:creator>some_bih</dc:creator>
      <dc:date>2024-05-30T06:45:52Z</dc:date>
    </item>
    <item>
      <title>Re: Price Effect - incorrect Sumx calculations when applying several filters from different tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Price-Effect-incorrect-Sumx-calculations-when-applying-several/m-p/3980426#M154324</link>
      <description>&lt;P&gt;Hi Some_bih,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry for the late answer. I actually found the answer for my problem thanks to you. As I dove deeper in the data to explain better what I wanted I found out that every time I had a customer that bought the product in particular year but not the other, the result of the price effect would be 0 because of this part of the formula "&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;OR&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;[€/Unit_Sold]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;[€/Unit_Sold_LY]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;,"&lt;/SPAN&gt;&amp;nbsp;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used this formula to get the correct result :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;!--  StartFragment   --&gt;&lt;SPAN class=""&gt;Price effect:=&lt;/SPAN&gt;&lt;SPAN class=""&gt;SUMX&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;SUMMARIZE&lt;/SPAN&gt;&lt;SPAN class=""&gt;(Sales;'Product'[Product_ID];Customer[Customer ID]);&lt;/SPAN&gt;&lt;SPAN class=""&gt;IF&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;OR&lt;/SPAN&gt;&lt;SPAN class=""&gt;([€/Unit_Sold]=0;[€/Unit_Sold_LY]=0);0;([€/Unit_Sold]-[€/Unit_Sold_LY])*[Quantity_wo_litigation])).&lt;/SPAN&gt;&lt;!--  EndFragment   --&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;However, I agree with your sentence there "&lt;/SPAN&gt;&lt;SPAN&gt;In DAX this is not "easy" as measures are not columns.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;This part should be rewritten to grasp DAX features." I just don't know how I can compare prices for a couple products &amp;amp; customers over different time periods doing differently. If you have an idea or a topid about it I'd be glad to hear about it !&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 15:46:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Price-Effect-incorrect-Sumx-calculations-when-applying-several/m-p/3980426#M154324</guid>
      <dc:creator>Eb50</dc:creator>
      <dc:date>2024-06-07T15:46:25Z</dc:date>
    </item>
    <item>
      <title>Re: Price Effect - incorrect Sumx calculations when applying several filters from different tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Price-Effect-incorrect-Sumx-calculations-when-applying-several/m-p/3980645#M154345</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="751649" data-lia-user-login="Eb50" class="lia-mention lia-mention-user"&gt;Eb50&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;share sample file with input and expected output for possible solution.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 17:59:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Price-Effect-incorrect-Sumx-calculations-when-applying-several/m-p/3980645#M154345</guid>
      <dc:creator>some_bih</dc:creator>
      <dc:date>2024-06-07T17:59:00Z</dc:date>
    </item>
  </channel>
</rss>

