<?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: Percentile of a table stored in a variable in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentile-of-a-table-stored-in-a-variable/m-p/2588814#M74519</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;You can try the following methods.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Table 2 =
SUMMARIZE (
    'Table 1',
    'Table 1'[Date],
    "Count Ticket", COUNT ( 'Table 1'[ID Ticket] )
)
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = CALCULATE(PERCENTILEX.EXC('Table 2',[Count Ticket],0.8),ALL('Table 2'))&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;In your case, k can be 0.2, 0.4, 0.6, 0.8.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Community Support Team _Charlotte&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Mon, 20 Jun 2022 08:52:23 GMT</pubDate>
    <dc:creator>v-zhangti</dc:creator>
    <dc:date>2022-06-20T08:52:23Z</dc:date>
    <item>
      <title>Percentile of a table stored in a variable</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentile-of-a-table-stored-in-a-variable/m-p/2580709#M74032</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I would like to detect outliers in my daily data report by using the percentile function.&lt;/P&gt;&lt;P&gt;I have a detail table (table 1) and I want to calculate the percentile of the second table which shows the tickets per day.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;If I create a fixed calculated table I have to add "ALL / AllExcept" function inside Percentile function:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366FF"&gt;Percentile = PERCENTILEX.EXC (ALL(TicketsByDate), TicketsByDate[Count_Tickets],&amp;nbsp; &amp;nbsp;.90 )&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to apply &lt;U&gt;external filters&lt;/U&gt; and I don't want to rely on the All/AllExcept function.&lt;/P&gt;&lt;P&gt;For this reason, I want to store my calculated table in a variable. The problem is that I can't calculate the percentile of this calculated table in a variable.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get the following error: "&lt;STRONG&gt;&lt;EM&gt;If k is not a multiple of 1/(n + 1), PERCENTILEX.EXC will interpolate to determine the value at the k-th percentile&lt;/EM&gt;&lt;/STRONG&gt;."&lt;/P&gt;&lt;P&gt;Can someone help me? Thanks!!!&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 15:18:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentile-of-a-table-stored-in-a-variable/m-p/2580709#M74032</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-15T15:18:38Z</dc:date>
    </item>
    <item>
      <title>Re: Percentile of a table stored in a variable</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentile-of-a-table-stored-in-a-variable/m-p/2588814#M74519</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;You can try the following methods.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Table 2 =
SUMMARIZE (
    'Table 1',
    'Table 1'[Date],
    "Count Ticket", COUNT ( 'Table 1'[ID Ticket] )
)
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = CALCULATE(PERCENTILEX.EXC('Table 2',[Count Ticket],0.8),ALL('Table 2'))&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;In your case, k can be 0.2, 0.4, 0.6, 0.8.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Community Support Team _Charlotte&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jun 2022 08:52:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentile-of-a-table-stored-in-a-variable/m-p/2588814#M74519</guid>
      <dc:creator>v-zhangti</dc:creator>
      <dc:date>2022-06-20T08:52:23Z</dc:date>
    </item>
    <item>
      <title>Re: Percentile of a table stored in a variable</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentile-of-a-table-stored-in-a-variable/m-p/2589146#M74532</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="332147" data-lia-user-login="v-zhangti" class="lia-mention lia-mention-user"&gt;v-zhangti&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;&lt;P&gt;First of all, thank you for your help.&lt;/P&gt;&lt;P&gt;The solution you propose allows me to calculate the percentile on the tickets total count. In this picture you can see that the data in both tables match (table 2 calculated as you told me).&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is that filters in table 2 don't work. In this image you can see that the filter "IsCloud" applies only for data in table 1.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;To solve that problem I guess I would have to add the dimensions I want to filter by to my table 2. There are too many dimensions I want to filter by, so I would like to avoid creating table 2 as fixed (its cardinality would be too large).&lt;/P&gt;&lt;P&gt;So, my idea is a temporary table stored in a variable where the filters apply correctly. I have tested this solution to get the total count (sum) of the tickets and it works --&amp;gt; The sum of tickets in table 1 and the sum of the table stored in a variable return the same value (with filters it also matches)&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;My problem is that it doesn't work for percentiles (I get the error: "If k is not a multiple of 1/(n + 1), PERCENTILEX.EXC will interpolate to determine the value at the k-th percentile.").&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please, if you have any idea how to do these calculations and make the filters work, I would appreciate it.&lt;/P&gt;&lt;P&gt;Thanks!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2022 07:34:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentile-of-a-table-stored-in-a-variable/m-p/2589146#M74532</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-21T07:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: Percentile of a table stored in a variable</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentile-of-a-table-stored-in-a-variable/m-p/2589192#M74534</link>
      <description>&lt;P&gt;By the way, I've also tried the percentile function with a measure but it doesn't work either. I get the same error.&lt;BR /&gt;If anyone can think of another solution... I need help&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks!!&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jun 2022 10:08:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentile-of-a-table-stored-in-a-variable/m-p/2589192#M74534</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-20T10:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: Percentile of a table stored in a variable</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentile-of-a-table-stored-in-a-variable/m-p/2594222#M74824</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;Can you provide simple pbix files?&amp;nbsp;There is so little information available that it is unclear what data the IsCloud slicer is filtering.&amp;nbsp;What kind of output do you expect when you select True for IsCloud? What kind of output do you expect when you select False?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best Regards&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2022 08:19:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentile-of-a-table-stored-in-a-variable/m-p/2594222#M74824</guid>
      <dc:creator>v-zhangti</dc:creator>
      <dc:date>2022-06-22T08:19:14Z</dc:date>
    </item>
    <item>
      <title>Re: Percentile of a table stored in a variable</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentile-of-a-table-stored-in-a-variable/m-p/2595355#M74901</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="332147" data-lia-user-login="v-zhangti" class="lia-mention lia-mention-user"&gt;v-zhangti&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;First of all, thank you for your help.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;My goal is to visualise in a column chart those days whose number of tickets represents an outlier (example 2).&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example 1&lt;/STRONG&gt; shows a column chart with the number of tickets per day. It uses a measure that performs a CountDistinct of the TicketId.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example 2&lt;/STRONG&gt; shows a column chart where red represents outliers and green represents normal values. It uses two complementary metrics. The important metric "&lt;EM&gt;&lt;U&gt;Outliers-Values&lt;/U&gt;&lt;/EM&gt;" uses the &lt;STRONG&gt;percentile function&lt;/STRONG&gt;. Days whose ticket counts are above the percentile are considered outliers (red).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My problem is I can't visualise correctly the data of example 2 when I &lt;STRONG&gt;apply filters&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;Looking at the following image with the slicer “&lt;U&gt;&lt;EM&gt;IsCloud=False&lt;/EM&gt;&lt;/U&gt;”, I would like to see in example 2 the same values as the column chart in example 1 and represent in red the column with 9 tickets.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I&amp;nbsp;&amp;nbsp;&lt;A href="https://drive.google.com/file/d/15z1rB9PvQUu1IlVDY9mP0tQjFMrtmnK0/view" target="_self"&gt;attach a pbix&lt;/A&gt;&amp;nbsp; with a simple dataset. The "&lt;EM&gt;&lt;U&gt;Tickets&lt;/U&gt;&lt;/EM&gt;" table presents the detail of the tickets I want to analyse and is connected to its dimension tables.&lt;/P&gt;&lt;P&gt;The table "&lt;EM&gt;&lt;U&gt;Tickets_By_Date&lt;/U&gt;&lt;/EM&gt;" is a summarize per date of the number of tickets in the "&lt;EM&gt;&lt;U&gt;Tickets&lt;/U&gt;&lt;/EM&gt;" table.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope I’ve been able to explain better my goal and the problem I have.&lt;/P&gt;&lt;P&gt;Any help is welcome and appreciated!&lt;/P&gt;&lt;P&gt;Thanks to all of you!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2022 15:30:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentile-of-a-table-stored-in-a-variable/m-p/2595355#M74901</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-22T15:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: Percentile of a table stored in a variable</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentile-of-a-table-stored-in-a-variable/m-p/2600657#M75147</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I've found the solution to my problem. In the first parameter of the percentile function you need to include a calculated table and use the &lt;EM&gt;SelectedAll&lt;/EM&gt; function.&lt;/P&gt;&lt;P&gt;This is the metric that calculates the outliers:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Outlier = 

VAR Percentile =  CALCULATE(PERCENTILEX.INC (
            SUMMARIZE (
                ALLSELECTED(Tickets),
                Tickets[Date],
                "Count", DISTINCTCOUNT(Tickets[TicketId])
            ),
            [Count],
            0.95
        ), ALLSELECTED())

RETURN CALCULATE( 'Calculations'[CountTickets_Measure], 
                    FILTER(
                        SUMMARIZE (
                                Tickets ,
                                Tickets[Date],
                                "Count", DISTINCTCOUNT(Tickets[TicketId])
                            ), 
                        [Count]&amp;gt;Percentile
                    )
                )&lt;/LI-CODE&gt;&lt;P&gt;And this is the complementary metric that calculates the green values in the column chart:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;StandardValues = IF( 'Calculations'[CountTickets_Measure] = 'Calculations'[OutlierTable], BLANK(), 'Calculations'[CountTickets_Measure])&lt;/LI-CODE&gt;&lt;P&gt;Thank you for your help!&lt;/P&gt;&lt;P&gt;I hope someone will find it useful &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 12:47:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentile-of-a-table-stored-in-a-variable/m-p/2600657#M75147</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-24T12:47:36Z</dc:date>
    </item>
  </channel>
</rss>

