<?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: DAX: Divide product by selected category in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Divide-product-by-selected-category/m-p/4286009#M170114</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="849033" data-lia-user-login="TessSA" class="lia-mention lia-mention-user"&gt;TessSA&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Here a few steps in oder to solve your problem. hope this helps:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Current Measure Logic:The current measure is dividing the sales of each category (A, B, and C) by the sales of category C.&amp;nbsp;As you mentioned, category C always shows 100%, which is expected because it's dividing the sales of category C by itself.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Excluding Category C:&amp;nbsp;The issue arises because the calculation doesn’t differentiate category C from the other categories.&amp;nbsp;You need to add a filter condition that excludes category C when calculating the percentage for categories A and B.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Solution Approach:&amp;nbsp;Use a Filter Condition: Modify the measure to apply a filter that only calculates the division for categories A and B, but not for C.&amp;nbsp;Conditional Calculation: You can include a condition to check if the selected category is not "C" and proceed with the calculation only for A and B.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Potential Solutions:&amp;nbsp;IF Statement: Use an IF statement to check if the category is C, and if so, return a blank or another result instead of performing the division.&amp;nbsp;FILTER Function: Apply the FILTER function to exclude the C category in your calculations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In short, modify the measure logic to exclude category C during the calculation, ensuring it does not impact the result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;% Sales on C =
var _category = SELECTEDVALUE('Won Quotes w Line Items from 2023 - PBI'[SKU Category])
var _value = SELECTEDVALUE('Won Quotes w Line Items from 2023 - PBI'[Quote Line Item: Total Price (converted).amount])
var _total = [Total C Sales]

-- Check if the selected category is not "C" and perform the division only for A and B
var _result = IF(_category &amp;lt;&amp;gt; "C", DIVIDE(_value, _total, ""), BLANK())

return _result&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 30 Jul 2025 12:55:55 GMT</pubDate>
    <dc:creator>rohit1991</dc:creator>
    <dc:date>2025-07-30T12:55:55Z</dc:date>
    <item>
      <title>DAX: Divide product by selected category</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Divide-product-by-selected-category/m-p/4285919#M170113</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have three product SKU categories (A, B, C) and would like to divide the total sales of each of categories A and B by one selected category (C). I have created the following measure in DAX:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;% Sales on C =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;_category&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;SELECTEDVALUE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Won Quotes w &amp;nbsp;Line Items from 2023 - PBI'&lt;/SPAN&gt;&lt;SPAN&gt;[SKU Category]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;_value&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;SELECTEDVALUE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Won Quotes w &amp;nbsp;Line Items from 2023 - PBI'&lt;/SPAN&gt;&lt;SPAN&gt;[Quote Line Item: Total Price (converted).amount]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;_total&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;[Total C Sales]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;_result&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;DIVIDE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;_value&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;_total&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;""&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;_result&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is calculating the sales of A, B and C categories divided by C. Is there a way to exclude C category from being calculated in the result? It's always going to show 100%...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See attached screenshot:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 10:52:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Divide-product-by-selected-category/m-p/4285919#M170113</guid>
      <dc:creator>TessSA</dc:creator>
      <dc:date>2024-11-15T10:52:56Z</dc:date>
    </item>
    <item>
      <title>Re: DAX: Divide product by selected category</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Divide-product-by-selected-category/m-p/4286009#M170114</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="849033" data-lia-user-login="TessSA" class="lia-mention lia-mention-user"&gt;TessSA&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Here a few steps in oder to solve your problem. hope this helps:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Current Measure Logic:The current measure is dividing the sales of each category (A, B, and C) by the sales of category C.&amp;nbsp;As you mentioned, category C always shows 100%, which is expected because it's dividing the sales of category C by itself.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Excluding Category C:&amp;nbsp;The issue arises because the calculation doesn’t differentiate category C from the other categories.&amp;nbsp;You need to add a filter condition that excludes category C when calculating the percentage for categories A and B.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Solution Approach:&amp;nbsp;Use a Filter Condition: Modify the measure to apply a filter that only calculates the division for categories A and B, but not for C.&amp;nbsp;Conditional Calculation: You can include a condition to check if the selected category is not "C" and proceed with the calculation only for A and B.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Potential Solutions:&amp;nbsp;IF Statement: Use an IF statement to check if the category is C, and if so, return a blank or another result instead of performing the division.&amp;nbsp;FILTER Function: Apply the FILTER function to exclude the C category in your calculations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In short, modify the measure logic to exclude category C during the calculation, ensuring it does not impact the result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;% Sales on C =
var _category = SELECTEDVALUE('Won Quotes w Line Items from 2023 - PBI'[SKU Category])
var _value = SELECTEDVALUE('Won Quotes w Line Items from 2023 - PBI'[Quote Line Item: Total Price (converted).amount])
var _total = [Total C Sales]

-- Check if the selected category is not "C" and perform the division only for A and B
var _result = IF(_category &amp;lt;&amp;gt; "C", DIVIDE(_value, _total, ""), BLANK())

return _result&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2025 12:55:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Divide-product-by-selected-category/m-p/4286009#M170114</guid>
      <dc:creator>rohit1991</dc:creator>
      <dc:date>2025-07-30T12:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: DAX: Divide product by selected category</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Divide-product-by-selected-category/m-p/4286098#M170117</link>
      <description>&lt;P&gt;Thank you very much, that worked like a charm!&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 12:59:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Divide-product-by-selected-category/m-p/4286098#M170117</guid>
      <dc:creator>TessSA</dc:creator>
      <dc:date>2024-11-15T12:59:51Z</dc:date>
    </item>
  </channel>
</rss>

