<?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 TOP N Visual with Parameter in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOP-N-Visual-with-Parameter/m-p/4235517#M167517</link>
    <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The other day I got some help making it posible to choose between 2 meassures to apply to a visual as can be seen below (image 1). Sales in $ vs sales in quantity which was solver&amp;nbsp; with "New Parameter" function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My actual issue is that while it is working perfectly, I want to add a TOP N filter. Usually when you add the TOP N it ask you by which value you want to short it. In this case it would be quantity or $, but when I add the newly create parameter which changes based on the selection, it is not doing a TOP N as see later (Image 2).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On some other site I was sugested to create a new meassure with a switch to use in the TOP N filter field, but it is not working and the visual returns an error that says :&amp;nbsp;&lt;EM&gt;Calculation error in measures 'Pedidos Lineas' [TOP N Measure]: Column [Top N Cantidad/Importe] is part of a composite key, but not al columns of the composite key are included in the expression or it's dependent expression.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here you have my code:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;TOP N Measure = SWITCH(SELECTEDVALUE('Top N Cantidad/Importe'[Top N Cantidad/Importe]),NAMEOF([Cantidad]),[Cantidad],NAMEOF([Importe Linea]),[Importe Linea],Blank())&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone tell my how can I do so that it does a TOP N which changes from quantity to $ when I chose the specific parameter. Adding the parameter to the filters on this visual wont work as seen below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks,&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;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 09 Oct 2024 16:08:07 GMT</pubDate>
    <dc:creator>kaintxu2</dc:creator>
    <dc:date>2024-10-09T16:08:07Z</dc:date>
    <item>
      <title>TOP N Visual with Parameter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOP-N-Visual-with-Parameter/m-p/4235517#M167517</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The other day I got some help making it posible to choose between 2 meassures to apply to a visual as can be seen below (image 1). Sales in $ vs sales in quantity which was solver&amp;nbsp; with "New Parameter" function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My actual issue is that while it is working perfectly, I want to add a TOP N filter. Usually when you add the TOP N it ask you by which value you want to short it. In this case it would be quantity or $, but when I add the newly create parameter which changes based on the selection, it is not doing a TOP N as see later (Image 2).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On some other site I was sugested to create a new meassure with a switch to use in the TOP N filter field, but it is not working and the visual returns an error that says :&amp;nbsp;&lt;EM&gt;Calculation error in measures 'Pedidos Lineas' [TOP N Measure]: Column [Top N Cantidad/Importe] is part of a composite key, but not al columns of the composite key are included in the expression or it's dependent expression.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here you have my code:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;TOP N Measure = SWITCH(SELECTEDVALUE('Top N Cantidad/Importe'[Top N Cantidad/Importe]),NAMEOF([Cantidad]),[Cantidad],NAMEOF([Importe Linea]),[Importe Linea],Blank())&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone tell my how can I do so that it does a TOP N which changes from quantity to $ when I chose the specific parameter. Adding the parameter to the filters on this visual wont work as seen below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks,&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;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 16:08:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOP-N-Visual-with-Parameter/m-p/4235517#M167517</guid>
      <dc:creator>kaintxu2</dc:creator>
      <dc:date>2024-10-09T16:08:07Z</dc:date>
    </item>
    <item>
      <title>Re: TOP N Visual with Parameter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOP-N-Visual-with-Parameter/m-p/4236057#M167561</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="703639" data-lia-user-login="kaintxu2" class="lia-mention lia-mention-user"&gt;kaintxu2&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Based on the description, try using the following DAX formula.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Selected Measure = SWITCH( SELECTEDVALUE('Top N Parameter'[Parameter]), "Cantidad", [Cantidad], "Importe", [Importe Linea], BLANK() )&lt;/LI-CODE&gt;
&lt;P&gt;Then, using the following measure to filter the TOP N.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Rank Measure = RANKX( ALL('YourTableName'), [Selected Measure], , DESC )&lt;/LI-CODE&gt;
&lt;P&gt;If the provided expression doesn't work, can you provide simple example data?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Wisdom Wu&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2024 02:23:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOP-N-Visual-with-Parameter/m-p/4236057#M167561</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-10-10T02:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: TOP N Visual with Parameter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOP-N-Visual-with-Parameter/m-p/4236442#M167577</link>
      <description>&lt;P&gt;Hi, thanks for the answer, I will try and provide some data. What is the best way to do so, just copy paste 2 examples from a table?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On the other hand, that Dax you mentioned on the second code, could you specify which is the table has to be the ranked one? If I chose the one with the original measures would not make sense right? As we are ranking grouped by Item type (Y Axis), and there is 2 different measures we want to use. I have tried usin the RANKX on the parameter table and it is not working&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2024 07:31:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOP-N-Visual-with-Parameter/m-p/4236442#M167577</guid>
      <dc:creator>kaintxu2</dc:creator>
      <dc:date>2024-10-10T07:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: TOP N Visual with Parameter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOP-N-Visual-with-Parameter/m-p/4242877#M167978</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="703639" data-lia-user-login="kaintxu2" class="lia-mention lia-mention-user"&gt;kaintxu2&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Creating the TOPN measure. View the following DAX formula and modify the table and column name.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Besides, you can also view the following blog to learn more information.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/367415" target="_blank" rel="noopener"&gt;Dynamic TopN made easy with What If Parameter - Microsoft Fabric Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Wisdom Wu&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2024 06:57:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOP-N-Visual-with-Parameter/m-p/4242877#M167978</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-04T06:57:12Z</dc:date>
    </item>
  </channel>
</rss>

