<?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: measure with function like TRIMMEAN of excel in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/measure-with-function-like-TRIMMEAN-of-excel/m-p/3867379#M151079</link>
    <description>&lt;P&gt;&lt;SPAN&gt;In Power BI, you can replicate the &lt;/SPAN&gt;TRIMMEAN&lt;SPAN&gt; function using DAX (Data Analysis Expressions). Below is a DAX formula to calculate the trimmean:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;TrimMean =&lt;BR /&gt;VAR Data = SUMMARIZE('Table', 'Table'[Value])&lt;BR /&gt;VAR Percent = 0.2 -- Change this to the desired percentage&lt;BR /&gt;VAR Count = COUNTROWS(Data)&lt;BR /&gt;VAR TrimCount = INT(Count * Percent)&lt;BR /&gt;RETURN&lt;BR /&gt;AVERAGEX(&lt;BR /&gt;TOPN(Count - 2 * TrimCount, Data, 'Table'[Value], ASC),&lt;BR /&gt;'Table'[Value]&lt;BR /&gt;)&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's what you need to do:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Replace 'Table' with the name of your table.&lt;/LI&gt;&lt;LI&gt;Replace 'Table'[Value] with the column that contains the values you want to calculate the trimmean for.&lt;/LI&gt;&lt;LI&gt;Change the Percent variable to the desired percentage.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Here's a step-by-step guide:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Open your Power BI Desktop.&lt;/LI&gt;&lt;LI&gt;In the "Modeling" tab, click on "New Measure".&lt;/LI&gt;&lt;LI&gt;Paste the DAX formula provided above and adjust it according to your data.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;For example, if you have a table named Sales and a column named Amount, your DAX formula would look like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;TrimMean =&lt;BR /&gt;VAR Data = SUMMARIZE('Sales', 'Sales'[Amount])&lt;BR /&gt;VAR Percent = 0.2 -- Change this to the desired percentage&lt;BR /&gt;VAR Count = COUNTROWS(Data)&lt;BR /&gt;VAR TrimCount = INT(Count * Percent)&lt;BR /&gt;RETURN&lt;BR /&gt;AVERAGEX(&lt;BR /&gt;TOPN(Count - 2 * TrimCount, Data, 'Sales'[Amount], ASC),&lt;BR /&gt;'Sales'[Amount]&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This DAX formula creates a new measure named TrimMean that calculates the trimmean of the Amount column in the Sales table, removing 20% of the data from the top and bottom tails.&lt;/P&gt;&lt;P&gt;You can then use this TrimMean measure in your reports and visuals just like any other measure.&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>Thu, 25 Apr 2024 06:43:08 GMT</pubDate>
    <dc:creator>123abc</dc:creator>
    <dc:date>2024-04-25T06:43:08Z</dc:date>
    <item>
      <title>measure with function like TRIMMEAN of excel</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/measure-with-function-like-TRIMMEAN-of-excel/m-p/3867083#M151062</link>
      <description>&lt;P&gt;Hello I am looking for a code like the trimmean function in excel.&lt;BR /&gt;The previvous posts i checked didn't help me finding a solution.&lt;BR /&gt;Maybe someone can help me with an kind of sample code and what i have to replave inside of the code...&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2024 05:13:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/measure-with-function-like-TRIMMEAN-of-excel/m-p/3867083#M151062</guid>
      <dc:creator>DSchmndtk</dc:creator>
      <dc:date>2024-04-25T05:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: measure with function like TRIMMEAN of excel</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/measure-with-function-like-TRIMMEAN-of-excel/m-p/3867379#M151079</link>
      <description>&lt;P&gt;&lt;SPAN&gt;In Power BI, you can replicate the &lt;/SPAN&gt;TRIMMEAN&lt;SPAN&gt; function using DAX (Data Analysis Expressions). Below is a DAX formula to calculate the trimmean:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;TrimMean =&lt;BR /&gt;VAR Data = SUMMARIZE('Table', 'Table'[Value])&lt;BR /&gt;VAR Percent = 0.2 -- Change this to the desired percentage&lt;BR /&gt;VAR Count = COUNTROWS(Data)&lt;BR /&gt;VAR TrimCount = INT(Count * Percent)&lt;BR /&gt;RETURN&lt;BR /&gt;AVERAGEX(&lt;BR /&gt;TOPN(Count - 2 * TrimCount, Data, 'Table'[Value], ASC),&lt;BR /&gt;'Table'[Value]&lt;BR /&gt;)&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's what you need to do:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Replace 'Table' with the name of your table.&lt;/LI&gt;&lt;LI&gt;Replace 'Table'[Value] with the column that contains the values you want to calculate the trimmean for.&lt;/LI&gt;&lt;LI&gt;Change the Percent variable to the desired percentage.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Here's a step-by-step guide:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Open your Power BI Desktop.&lt;/LI&gt;&lt;LI&gt;In the "Modeling" tab, click on "New Measure".&lt;/LI&gt;&lt;LI&gt;Paste the DAX formula provided above and adjust it according to your data.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;For example, if you have a table named Sales and a column named Amount, your DAX formula would look like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;TrimMean =&lt;BR /&gt;VAR Data = SUMMARIZE('Sales', 'Sales'[Amount])&lt;BR /&gt;VAR Percent = 0.2 -- Change this to the desired percentage&lt;BR /&gt;VAR Count = COUNTROWS(Data)&lt;BR /&gt;VAR TrimCount = INT(Count * Percent)&lt;BR /&gt;RETURN&lt;BR /&gt;AVERAGEX(&lt;BR /&gt;TOPN(Count - 2 * TrimCount, Data, 'Sales'[Amount], ASC),&lt;BR /&gt;'Sales'[Amount]&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This DAX formula creates a new measure named TrimMean that calculates the trimmean of the Amount column in the Sales table, removing 20% of the data from the top and bottom tails.&lt;/P&gt;&lt;P&gt;You can then use this TrimMean measure in your reports and visuals just like any other measure.&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>Thu, 25 Apr 2024 06:43:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/measure-with-function-like-TRIMMEAN-of-excel/m-p/3867379#M151079</guid>
      <dc:creator>123abc</dc:creator>
      <dc:date>2024-04-25T06:43:08Z</dc:date>
    </item>
    <item>
      <title>Re: measure with function like TRIMMEAN of excel</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/measure-with-function-like-TRIMMEAN-of-excel/m-p/3874770#M151331</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="723429" data-lia-user-login="DSchmndtk" class="lia-mention lia-mention-user"&gt;DSchmndtk&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;Here some steps that I want to share, you can check them if they suitable for your requirement.&lt;BR /&gt;Here is my test data:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Create a Rank column&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Rank = RANKX('Table',[Value],,ASC)&lt;/LI-CODE&gt;
&lt;P&gt;Create a measure&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Trimmed Mean = 
VAR _percentage = 0.3
VAR _startRank = FLOOR(COUNTROWS('Table')*_percentage/2+1,1)
VAR _endRank = COUNTROWS('Table')*(1-FLOOR(_percentage/2,0.1))
VAR _sum = 
CALCULATE(
    SUM('Table'[Value]),
    FILTER(
        'Table',
        'Table'[Rank] &amp;lt;=_endRank &amp;amp;&amp;amp; 'Table'[Rank] &amp;gt;= _startRank
    )
)
VAR _count = COUNTROWS('Table')*(1-FLOOR(_percentage/2,0.1)*2)
RETURN
_sum/_count&lt;/LI-CODE&gt;
&lt;P&gt;Final output&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Albert He&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post &lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider &lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt; to help the other members find it more quickly&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2024 08:33:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/measure-with-function-like-TRIMMEAN-of-excel/m-p/3874770#M151331</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-04-29T08:33:23Z</dc:date>
    </item>
  </channel>
</rss>

