<?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: Dynamic ranking of a parameter value in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-ranking-of-a-parameter-value/m-p/4699348#M180010</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="195903" data-lia-user-login="czaldumbide" class="lia-mention lia-mention-user"&gt;czaldumbide&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We wanted to kindly check in to see if everything is working as expected after trying the suggested solution. If there’s anything else we can assist with, please don’t hesitate to ask.&lt;/P&gt;
&lt;P&gt;If the issue is resolved, we’d appreciate it if you could mark the helpful reply as &lt;STRONG&gt;Accepted Solution&lt;/STRONG&gt;&amp;nbsp; it helps others who might face a similar issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Warm regards,&lt;/P&gt;
&lt;P&gt;Prasanna Kumar&lt;/P&gt;</description>
    <pubDate>Tue, 20 May 2025 06:05:34 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2025-05-20T06:05:34Z</dc:date>
    <item>
      <title>Dynamic ranking of a parameter value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-ranking-of-a-parameter-value/m-p/4613567#M176562</link>
      <description>&lt;P&gt;Hi!&lt;BR /&gt;&lt;BR /&gt;Would appreciate help figuring out how to create a measure that calculates the dynamic ranking of a parameter value.&lt;BR /&gt;&lt;BR /&gt;Let me provide context. I have a 'Transactions' table with columns &amp;lt;ID&amp;gt;, &amp;lt;Weeknum&amp;gt;, &amp;lt;Amount&amp;gt;, &amp;lt;Category&amp;gt;. I'm interested in looking at the aggregate amount per week per ID, and its ranking. My&amp;nbsp; &amp;nbsp;report will have a slicer filter where the user can select different categories, therefore my grouped table becomes dynamic. Additionally,&amp;nbsp; the user is able to input a value as a parameter that represents a weekly aggregate amount. Let's call that parameter value the 'threshold'. The objective is to figure out what rank is this threshold out of the grouped table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example of original 'Transactions' table&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Weeknum&amp;nbsp; &amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Amount&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Category&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;111&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;111&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;111&lt;/TD&gt;&lt;TD&gt;31&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;222&lt;/TD&gt;&lt;TD&gt;31&lt;/TD&gt;&lt;TD&gt;150&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;222&lt;/TD&gt;&lt;TD&gt;31&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;222&lt;/TD&gt;&lt;TD&gt;32&lt;/TD&gt;&lt;TD&gt;300&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example of Grouped Table and ranking if filtered by Category A&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Weeknum&amp;nbsp; &amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Weekly Amount&amp;nbsp; &amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Ranking ASC&amp;nbsp;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;111&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;222&lt;/TD&gt;&lt;TD&gt;31&lt;/TD&gt;&lt;TD&gt;350&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;222&lt;/TD&gt;&lt;TD&gt;32&lt;/TD&gt;&lt;TD&gt;300&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So if the threshold selected = 300, then my ranking measure should return 2.&lt;BR /&gt;&lt;BR /&gt;Was thinking of using RANK.EQ function with threshold as the 'number' argument, but I'm stuck at the 'ref' argument. I can't pass a summarized table as the ref argument as it gives me the error that the base table can't be found. Please let me know how can I modify this to achieve the desired result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2025 20:58:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-ranking-of-a-parameter-value/m-p/4613567#M176562</guid>
      <dc:creator>czaldumbide</dc:creator>
      <dc:date>2025-03-17T20:58:16Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic ranking of a parameter value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-ranking-of-a-parameter-value/m-p/4613676#M176568</link>
      <description>&lt;P&gt;There's no need for a summarized table - as you already have the filter context based on your category filter.&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;&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;And then you can sneak in the threshold value as needed - as the "value"&amp;nbsp; optional parameter for RANKX.&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;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2025 00:24:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-ranking-of-a-parameter-value/m-p/4613676#M176568</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2025-03-18T00:24:25Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic ranking of a parameter value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-ranking-of-a-parameter-value/m-p/4617013#M176686</link>
      <description>&lt;P&gt;I'm still having trouble with the ranking function when slicers are applied to the report page.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;To make this exercise easier I have attached a picture of my report page and a sample PBI file. The columns highlighted in red are the ones not working properly yet. Would appreciate any tips on&amp;nbsp; how to modify these measures.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Rank = 
RANKX(ALLSELECTED(Sales[WeekNum], Sales[ClientID]), CALCULATE([Sales]),, ASC)&lt;/LI-CODE&gt;&lt;DIV&gt;&lt;FONT color="#FF0000"&gt;------ this measure should return the position of the [sales] measure grouped by weeknum and client ID in ascending order, taking in account the filters from the slicer. So rank should have values from 1 to 138.&amp;nbsp;&lt;BR /&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;LI-CODE lang="markup"&gt;Percentile = 
([Rank] -1)/ [Count All Selected Grouped by week and client]​&lt;/LI-CODE&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;------ Should return the percentile of the corresponding [sales] measure based on the selected unique combinations of weenum and clientID, again taking in account filters from slicers.&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;LI-CODE lang="markup"&gt;Closest Amount to Parameter = 
var threshold = Parameter[Parameter Value]
var closest_above = MINX(FILTER(Sales, Sales[Amount]&amp;gt;= threshold), Sales[Amount])
    MINX(FILTER(Sales, Sales[Amount]&amp;gt;= threshold), Sales[Amount])
var closest_below =
    MAXX(FILTER(Sales, Sales[Amount] &amp;lt;= threshold), Sales[Amount])
return if(abs(threshold-closest_above) &amp;lt; abs(threshold-closest_below), closest_above, closest_below)&lt;/LI-CODE&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;FONT color="#FF0000"&gt;---- Should return closest value to grouped table (in this case closest would have been 13400, instead of 15000). Currently it is returning closest value to original [sales] column, rather than [sales] measure grouped by clientID and weeknum.&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Rank of Parameter = 
RANKX( ALLSELECTED(Sales[WeekNum], Sales[ClientID]), CALCULATE([Sales]), [Closest amount to parameter],ASC)​&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#FF0000"&gt;-----&amp;nbsp; should return the position in relation to sales grouped by weeknum and clientID. Basically if you look at the table underneath, what would the parameter value's position be.&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;img /&gt;&lt;BR /&gt;&amp;nbsp;&lt;A title="SampleRanking" href="https://nc.pichinchamiami.com/index.php/s/3iemrYpRQmBG7By" target="_self"&gt;Link to pbix file&lt;/A&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2025 17:41:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-ranking-of-a-parameter-value/m-p/4617013#M176686</guid>
      <dc:creator>czaldumbide</dc:creator>
      <dc:date>2025-03-19T17:41:36Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic ranking of a parameter value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-ranking-of-a-parameter-value/m-p/4692055#M179671</link>
      <description>&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="195903" data-lia-user-login="czaldumbide" class="lia-mention lia-mention-user"&gt;czaldumbide&lt;/a&gt;,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;Just following up to see if the solution provided was helpful in resolving your issue. Please feel free to let us know if you need any further assistance.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;If the response addressed your query, kindly mark it as &lt;SPAN&gt;Accepted Solution&lt;/SPAN&gt; and click &lt;SPAN&gt;Yes&lt;/SPAN&gt; if you found it helpful — this will benefit others in the community as well.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;Best regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;Prasanna Kumar&lt;/P&gt;</description>
      <pubDate>Wed, 14 May 2025 08:37:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-ranking-of-a-parameter-value/m-p/4692055#M179671</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-05-14T08:37:48Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic ranking of a parameter value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-ranking-of-a-parameter-value/m-p/4699348#M180010</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="195903" data-lia-user-login="czaldumbide" class="lia-mention lia-mention-user"&gt;czaldumbide&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We wanted to kindly check in to see if everything is working as expected after trying the suggested solution. If there’s anything else we can assist with, please don’t hesitate to ask.&lt;/P&gt;
&lt;P&gt;If the issue is resolved, we’d appreciate it if you could mark the helpful reply as &lt;STRONG&gt;Accepted Solution&lt;/STRONG&gt;&amp;nbsp; it helps others who might face a similar issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Warm regards,&lt;/P&gt;
&lt;P&gt;Prasanna Kumar&lt;/P&gt;</description>
      <pubDate>Tue, 20 May 2025 06:05:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-ranking-of-a-parameter-value/m-p/4699348#M180010</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-05-20T06:05:34Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic ranking of a parameter value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-ranking-of-a-parameter-value/m-p/4704574#M180185</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="195903" data-lia-user-login="czaldumbide" class="lia-mention lia-mention-user"&gt;czaldumbide&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just a gentle reminder&amp;nbsp; has your issue been resolved? If so, we’d be grateful if you could mark the solution that worked as &lt;STRONG&gt;Accepted Solution&lt;/STRONG&gt;, or feel free to share your own if you found a different fix.&lt;/P&gt;
&lt;P&gt;This not only closes the loop on your query but also helps others in the community solve similar issues faster.&lt;/P&gt;
&lt;P&gt;Thank you for your time and feedback!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;Prasanna Kumar&lt;/P&gt;</description>
      <pubDate>Fri, 23 May 2025 06:12:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-ranking-of-a-parameter-value/m-p/4704574#M180185</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-05-23T06:12:07Z</dc:date>
    </item>
  </channel>
</rss>

