<?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: Troubleshooting Percent calculation - Divide row total by total for all rows in matrix in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Troubleshooting-Percent-calculation-Divide-row-total-by-total/m-p/3672235#M142454</link>
    <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps you could modify the formula to look like this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;# % = 
VAR Total_Market_Value_Base = 
    SUM(HoldingsTDMaster[Market Value (Base)]) + (SUM(HoldingsTDMaster[Accrued Interest]) * SUM(HoldingsTDMaster[FX to Target]))
RETURN 
DIVIDE(
    Total_Market_Value_Base,
    COUNTROWS(HoldingsTDMaster)
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is still a problem,&amp;nbsp;please provide sample data and the result you are hoping for:&amp;nbsp;&lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;How to provide sample data in the Power BI Forum - Microsoft Fabric Community&lt;/A&gt; .&amp;nbsp;Or show it as a screenshot or pbix. Please remove any sensitive data in advance. If uploading pbix files please do not log into your account.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Community Support Team _Yuliax&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps, then please consider &lt;EM&gt;Accept it as the solution to help the other members find it more quickly.&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 01 Feb 2024 07:11:34 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-02-01T07:11:34Z</dc:date>
    <item>
      <title>Troubleshooting Percent calculation - Divide row total by total for all rows in matrix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Troubleshooting-Percent-calculation-Divide-row-total-by-total/m-p/3671058#M142410</link>
      <description>&lt;P&gt;I am creating a measure which calculates the percentage of a total and applies it to a matrix.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am then dividing the calculation of Total_Market_Value_Base by the sum total of all rows and that is represnted as the # % column.&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;# % = 

VAR Total_Market_Value_Base = 
    SUM(HoldingsTDMaster[Market Value (Base)]) + (SUM(HoldingsTDMaster[Accrued Interest]) * SUM(HoldingsTDMaster[FX to Target]))

RETURN 
DIVIDE(
    Total_Market_Value_Base,
    CALCULATE(
        Total_Market_Value_Base,
        ALLSELECTED(HoldingsTDMaster)
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see the visual displays 1.00 for every row. I included the variable Total_Market_Value_Base in the column #%Test so you can see the number I want divided. #%Test should be divided by the total of all rows in the matrix, but it seems like with #% it is not dividing by all rows but just by just it's own row. Is ALLSELECTED the wrong function to be using?&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;Here is my model. There is a 1:many relationship between the table for Account Name and the rest of the fields. Sector comes from HoldingsTDMaster as well as all the fields for the calculation.&amp;nbsp;Any help is much appreciated.&amp;nbsp;&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;</description>
      <pubDate>Wed, 31 Jan 2024 18:10:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Troubleshooting-Percent-calculation-Divide-row-total-by-total/m-p/3671058#M142410</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-01-31T18:10:01Z</dc:date>
    </item>
    <item>
      <title>Re: Troubleshooting Percent calculation - Divide row total by total for all rows in matrix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Troubleshooting-Percent-calculation-Divide-row-total-by-total/m-p/3672235#M142454</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps you could modify the formula to look like this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;# % = 
VAR Total_Market_Value_Base = 
    SUM(HoldingsTDMaster[Market Value (Base)]) + (SUM(HoldingsTDMaster[Accrued Interest]) * SUM(HoldingsTDMaster[FX to Target]))
RETURN 
DIVIDE(
    Total_Market_Value_Base,
    COUNTROWS(HoldingsTDMaster)
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is still a problem,&amp;nbsp;please provide sample data and the result you are hoping for:&amp;nbsp;&lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;How to provide sample data in the Power BI Forum - Microsoft Fabric Community&lt;/A&gt; .&amp;nbsp;Or show it as a screenshot or pbix. Please remove any sensitive data in advance. If uploading pbix files please do not log into your account.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Community Support Team _Yuliax&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps, then please consider &lt;EM&gt;Accept it as the solution to help the other members find it more quickly.&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2024 07:11:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Troubleshooting-Percent-calculation-Divide-row-total-by-total/m-p/3672235#M142454</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-01T07:11:34Z</dc:date>
    </item>
    <item>
      <title>Re: Troubleshooting Percent calculation - Divide row total by total for all rows in matrix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Troubleshooting-Percent-calculation-Divide-row-total-by-total/m-p/3673386#M142528</link>
      <description>&lt;P&gt;Hello, thanks for responding. This doesn't really give me what I need. I'm looking for the Total_Market_Value_Base of the row in the matrix, divided by the sum total of Total_Market_Value_Base for all rows within a sector category. This solution is just dividing Total_Market_Value_Base by a count of the rows in HoldingsTDMaster.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://drive.google.com/file/d/1RifVPqfWGviFr793luwbCdMLPezTsbqE/view?usp=sharing" target="_blank"&gt;https://drive.google.com/file/d/1RifVPqfWGviFr793luwbCdMLPezTsbqE/view?usp=sharing&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The link is a pbix with some de-identified sample data and some additional notes. Thank you very much for your help.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2024 16:12:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Troubleshooting-Percent-calculation-Divide-row-total-by-total/m-p/3673386#M142528</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-01T16:12:06Z</dc:date>
    </item>
    <item>
      <title>Re: Troubleshooting Percent calculation - Divide row total by total for all rows in matrix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Troubleshooting-Percent-calculation-Divide-row-total-by-total/m-p/3673451#M142534</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would these measures help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Total_Market_Value_Base =
    SUM( HoldingsTDMaster[Market Value (Base)] )
        + (
            SUM( HoldingsTDMaster[Accrued Interest] )
                * SUM( HoldingsTDMaster[FX to Target] )
        )


# % =
    DIVIDE(
        [Total_Market_Value_Base],
        CALCULATE(
            [Total_Market_Value_Base],
            ALLSELECTED( HoldingsTDMaster )
        )
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if you have any questions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://1drv.ms/u/s!AnF6rI36HAVkhYRMrjhaj0DQPyd7cg?e=GcHkVx" target="_blank"&gt;Support Forum Version.pbix&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2024 18:15:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Troubleshooting-Percent-calculation-Divide-row-total-by-total/m-p/3673451#M142534</guid>
      <dc:creator>gmsamborn</dc:creator>
      <dc:date>2024-02-01T18:15:02Z</dc:date>
    </item>
    <item>
      <title>Re: Troubleshooting Percent calculation - Divide row total by total for all rows in matrix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Troubleshooting-Percent-calculation-Divide-row-total-by-total/m-p/3673706#M142550</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="426215" data-lia-user-login="gmsamborn" class="lia-mention lia-mention-user"&gt;gmsamborn&lt;/a&gt;. thanks for your reply. This got me a lot closer, I am now getting a different result for each row.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm still struggling though because the #% column isn't totaling to 100. I think when doing the CALCULATE() for the denominator to divide by, the measure will total the data for each field of the measure, then calculate [Total_Market_Value_Base], but I need it to perform that calculation for each row, and then sum the results for each row, and divide by that number. Can you help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I updated the sample data here with your suggested measure.&amp;nbsp;&lt;A href="https://drive.google.com/file/d/1RifVPqfWGviFr793luwbCdMLPezTsbqE/view?usp=drive_link" target="_blank"&gt;https://drive.google.com/file/d/1RifVPqfWGviFr793luwbCdMLPezTsbqE/view?usp=drive_link&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2024 18:26:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Troubleshooting-Percent-calculation-Divide-row-total-by-total/m-p/3673706#M142550</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-01T18:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: Troubleshooting Percent calculation - Divide row total by total for all rows in matrix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Troubleshooting-Percent-calculation-Divide-row-total-by-total/m-p/3673743#M142554</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In your original version of [# %], you were using a variable instead of an expression or measure in your denominator.&amp;nbsp; That would be the reason you were getting 1 for every row.&amp;nbsp; (ie. you can't recalculate a variable).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only thing I did was split your measure out into 2 measures.&amp;nbsp; That means there was a separate problem in your original measure (or what is the new measure [# Total_Market_Value_Base] ).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll take a look at that series of SUMs but you would probably have as much luck.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2024 18:45:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Troubleshooting-Percent-calculation-Divide-row-total-by-total/m-p/3673743#M142554</guid>
      <dc:creator>gmsamborn</dc:creator>
      <dc:date>2024-02-01T18:45:19Z</dc:date>
    </item>
    <item>
      <title>Re: Troubleshooting Percent calculation - Divide row total by total for all rows in matrix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Troubleshooting-Percent-calculation-Divide-row-total-by-total/m-p/3673755#M142555</link>
      <description>&lt;P&gt;I was messing with the measures and figured it out, I needed to be adding some iterators at different stages to get it to aggregate on the right level. Here are the two measures I ended up with. Thanks again for your help.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# % = 
DIVIDE(
    [# Total_Market_Value_Base],
    CALCULATE(
        SUMX(HoldingsTDMaster,[# Total_Market_Value_Base]),
        ALLSELECTED(HoldingsTDMaster)
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# Total_Market_Value_Base = 
SUMX(HoldingsTDMaster,[Market Value (Base)] + ([Accrued Interest] * [FX to Target]))&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 01 Feb 2024 18:56:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Troubleshooting-Percent-calculation-Divide-row-total-by-total/m-p/3673755#M142555</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-01T18:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: Troubleshooting Percent calculation - Divide row total by total for all rows in matrix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Troubleshooting-Percent-calculation-Divide-row-total-by-total/m-p/3673758#M142556</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After taking a look at your measure, I thought this might be more like what you want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ORIGINAL&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# Total_Market_Value_Base =
SUMX(
    HoldingsTDMaster,
    [Market Value (Base)]
)
    + (
        SUMX(
            HoldingsTDMaster,
            [Accrued Interest]
        )
            * SUMX(
                HoldingsTDMaster,
                [FX to Target]
            )
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NEW&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# Total_Market_Value_Base = 
SUMX(
    HoldingsTDMaster,
    [Market Value (Base)] + ([Accrued Interest] * [FX to Target])
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if that is what you meant.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2024 19:10:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Troubleshooting-Percent-calculation-Divide-row-total-by-total/m-p/3673758#M142556</guid>
      <dc:creator>gmsamborn</dc:creator>
      <dc:date>2024-02-01T19:10:46Z</dc:date>
    </item>
    <item>
      <title>Re: Troubleshooting Percent calculation - Divide row total by total for all rows in matrix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Troubleshooting-Percent-calculation-Divide-row-total-by-total/m-p/3673764#M142557</link>
      <description>&lt;P&gt;You were on the right track, take a look at my last post to see what I ended up with.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2024 19:05:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Troubleshooting-Percent-calculation-Divide-row-total-by-total/m-p/3673764#M142557</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-01T19:05:08Z</dc:date>
    </item>
    <item>
      <title>Re: Troubleshooting Percent calculation - Divide row total by total for all rows in matrix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Troubleshooting-Percent-calculation-Divide-row-total-by-total/m-p/3673769#M142558</link>
      <description>&lt;P&gt;Glad you were able to figure it out.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2024 19:06:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Troubleshooting-Percent-calculation-Divide-row-total-by-total/m-p/3673769#M142558</guid>
      <dc:creator>gmsamborn</dc:creator>
      <dc:date>2024-02-01T19:06:41Z</dc:date>
    </item>
  </channel>
</rss>

