<?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: Slicer selection not Working in a Virtual Table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Slicer-selection-not-Working-in-a-Virtual-Table/m-p/4294544#M170444</link>
    <description>&lt;P&gt;Thanks for the reply from&amp;nbsp;Poojara_D12.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="823061" data-lia-user-login="jimmyhua" class="lia-mention lia-mention-user"&gt;jimmyhua&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please use the following DAX formula:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Ranked Table Filter = 
VAR SelectedN = IF(HASONEVALUE('TopN Table'[Value]),MAX('TopN Table'[Value]),MIN('TopN Table'[Value])) 
RETURN
    FILTER(
        'RankedTable',
        [Rank] &amp;lt;= SelectedN
    )&lt;/LI-CODE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Zhu&lt;BR /&gt;Community Support Team&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;I&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/I&gt;, then please consider&amp;nbsp;&lt;I&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/I&gt;&amp;nbsp;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Nov 2024 05:35:04 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-11-21T05:35:04Z</dc:date>
    <item>
      <title>Slicer selection not Working in a Virtual Table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Slicer-selection-not-Working-in-a-Virtual-Table/m-p/4287020#M170146</link>
      <description>&lt;P&gt;I created a virtual table with rankings.&amp;nbsp; then I created a real table called TopN using Generateseries to create a list of int numbers and made a slicer.&amp;nbsp; last I create a variable called SelectedN .&lt;BR /&gt;the TopN Table =&amp;nbsp;&lt;SPAN&gt;GENERATESERIES&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;5&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;30&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;5&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;then i created a VAR&amp;nbsp;&lt;SPAN&gt;SelectedN = &lt;/SPAN&gt;&lt;SPAN&gt;SELECTEDVALUE&lt;/SPAN&gt;&lt;SPAN&gt;(TopNTable[Value]),&lt;BR /&gt;Last I added the VAR to the filter to the virtual table called RankedTable.&amp;nbsp; however, it gives me blank.&amp;nbsp; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; RankedTable,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [RankByBL] &amp;lt;= SelectedN)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;then I checked the slicer in the visual using card the selection was fine.&amp;nbsp; last I replace SelectedN with hardcode 15 or 10, the table filtered correctly.&amp;nbsp; I also tried to changed&amp;nbsp;&lt;SPAN&gt;SELECTEDVALUE&lt;/SPAN&gt;&lt;SPAN&gt;(TopNTable[Value], Max(TopNTable[Value])), the SelectedN will pickup the default Max number which is 30 in this case, even if I have the slicer at 15.&amp;nbsp; So&amp;nbsp;SELECTEDVALUE(TopNTable[Value]) is giving me empty result.&amp;nbsp; why it behaive like that?&amp;nbsp; Thanks for helping.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 16 Nov 2024 11:25:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Slicer-selection-not-Working-in-a-Virtual-Table/m-p/4287020#M170146</guid>
      <dc:creator>jimmyhua</dc:creator>
      <dc:date>2024-11-16T11:25:07Z</dc:date>
    </item>
    <item>
      <title>Re: Slicer selection not Working in a Virtual Table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Slicer-selection-not-Working-in-a-Virtual-Table/m-p/4287113#M170147</link>
      <description>&lt;P&gt;You cannot meaningfully create calculated tables from measures or slicers.&amp;nbsp; Only works the other way round.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 13:40:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Slicer-selection-not-Working-in-a-Virtual-Table/m-p/4287113#M170147</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-11-16T13:40:45Z</dc:date>
    </item>
    <item>
      <title>Re: Slicer selection not Working in a Virtual Table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Slicer-selection-not-Working-in-a-Virtual-Table/m-p/4287953#M170195</link>
      <description>&lt;P&gt;Thanks for the reply from&amp;nbsp;lbendlin.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="823061" data-lia-user-login="jimmyhua" class="lia-mention lia-mention-user"&gt;jimmyhua&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;FONT&gt;The SELECTEDVALUE function returns the value when the context for columnName has been filtered down to a single distinct value; otherwise, it returns an alternative value. If no alternative value is provided and the slicer is not filtered, SELECTEDVALUE returns null when there is no single distinct value in the context.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the TopNTable you create has only one value, then you don't need to use a slicer.&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;Best Regards,&lt;BR /&gt;Zhu&lt;BR /&gt;Community Support Team&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;I&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/I&gt;, then please consider&amp;nbsp;&lt;I&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/I&gt;&amp;nbsp;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2024 02:27:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Slicer-selection-not-Working-in-a-Virtual-Table/m-p/4287953#M170195</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-18T02:27:17Z</dc:date>
    </item>
    <item>
      <title>Re: Slicer selection not Working in a Virtual Table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Slicer-selection-not-Working-in-a-Virtual-Table/m-p/4288758#M170214</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="823061" data-lia-user-login="jimmyhua" class="lia-mention lia-mention-user"&gt;jimmyhua&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The behavior you're observing is due to &lt;STRONG&gt;filter context&lt;/STRONG&gt; and how the SELECTEDVALUE function works in DAX. Let's analyze the situation and resolve the issue step by step:&lt;/P&gt;&lt;HR /&gt;&lt;H3&gt;&lt;STRONG&gt;Why SelectedN Returns Blank&lt;/STRONG&gt;&lt;/H3&gt;&lt;P&gt;The SELECTEDVALUE function depends on the &lt;STRONG&gt;filter context&lt;/STRONG&gt; applied to the column. When you use a slicer to filter the TopN Table, the selection is applied to that specific column. However, if you reference SELECTEDVALUE(TopNTable[Value]) in a different table's measure (e.g., your virtual RankedTable), the filter context from the slicer may not propagate to that measure or visual.&lt;/P&gt;&lt;P&gt;This is why SelectedN is blank in some scenarios, but when you hardcode a value like 15 or 10, the filter works as expected.&lt;/P&gt;&lt;HR /&gt;&lt;H3&gt;&lt;STRONG&gt;Solution&lt;/STRONG&gt;&lt;/H3&gt;&lt;P&gt;To fix this, ensure the slicer's filter context is explicitly passed to your calculation. Here’s how:&lt;/P&gt;&lt;H4&gt;1. &lt;STRONG&gt;Define SelectedN Safely&lt;/STRONG&gt;&lt;/H4&gt;&lt;P&gt;Use MAX instead of SELECTEDVALUE, which ensures that the slicer's selection is retrieved correctly, even if used outside the slicer's visual context:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;VAR SelectedN = MAX(TopNTable[Value])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;MAX works because the slicer limits the TopNTable[Value] column to a single value, making it equivalent to SELECTEDVALUE in this case.&lt;/LI&gt;&lt;/UL&gt;&lt;H4&gt;2. &lt;STRONG&gt;Apply Filter to RankedTable&lt;/STRONG&gt;&lt;/H4&gt;&lt;P&gt;Use the SelectedN variable directly in your filter condition:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;RETURN
    FILTER(
        RankedTable,
        [RankByBL] &amp;lt;= SelectedN
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H3&gt;&lt;STRONG&gt;Alternative Debugging Step&lt;/STRONG&gt;&lt;/H3&gt;&lt;P&gt;If SelectedN is still blank, verify that the slicer is affecting the filter context. Create a debugging measure to display the current value of SelectedN:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Debug SelectedN = MAX(TopNTable[Value])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Add this measure to a &lt;STRONG&gt;card visual&lt;/STRONG&gt; to confirm the slicer selection. If this returns blank:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Check the relationships between the TopN Table and other tables. A missing or inactive relationship can prevent the slicer's selection from propagating.&lt;/LI&gt;&lt;LI&gt;Verify that the slicer has valid options (e.g., numbers between 5 and 30) and isn't clearing filters.&lt;/LI&gt;&lt;/UL&gt;&lt;HR /&gt;&lt;H3&gt;&lt;STRONG&gt;Ensuring Slicer Works with the Visual&lt;/STRONG&gt;&lt;/H3&gt;&lt;P&gt;To ensure that the slicer's selection dynamically filters the RankedTable, follow these steps:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;Confirm that TopNTable[Value] is directly used in the slicer.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Verify that the TopN Table exists in the data model and isn't only a disconnected table. If it’s disconnected, you may need to adjust the logic or use a measure like this:&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SelectedN = 
CALCULATE(
    MAX(TopNTable[Value]),
    ALLSELECTED(TopNTable)
)&lt;/LI-CODE&gt;&lt;P&gt;Ensure the slicer is set to &lt;STRONG&gt;Single Select&lt;/STRONG&gt; mode for proper behavior.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;HR /&gt;&lt;H3&gt;Final Measure Example&lt;/H3&gt;&lt;P&gt;Here’s your final measure incorporating the solutions:&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Ranked Table Filter = 
VAR SelectedN = MAX(TopNTable[Value]) // Ensure selection is retrieved
RETURN
    FILTER(
        RankedTable,
        [RankByBL] &amp;lt;= SelectedN
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Did I answer your question? Mark my post as a solution, this will help others!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;If my response(s) assisted you in any way, don't forget to drop me a "&lt;STRONG&gt;Kudos&lt;/STRONG&gt;" &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;BR /&gt;Poojara&lt;BR /&gt;Data Analyst | MSBI Developer | Power BI Consultant&lt;BR /&gt;&lt;STRONG&gt;YouTube&lt;/STRONG&gt;: &lt;A href="https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS" target="_blank" rel="noopener"&gt;https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2024 11:13:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Slicer-selection-not-Working-in-a-Virtual-Table/m-p/4288758#M170214</guid>
      <dc:creator>Poojara_D12</dc:creator>
      <dc:date>2024-11-18T11:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: Slicer selection not Working in a Virtual Table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Slicer-selection-not-Working-in-a-Virtual-Table/m-p/4291999#M170307</link>
      <description>&lt;P&gt;Hi PooJara,&lt;BR /&gt;Thank you for the detail response.&amp;nbsp; yes. the table would react to MAX(TopNTable[Value]), however, since it gives the largest selection, how it can help me to use it when I want to select a lower value?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2024 23:08:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Slicer-selection-not-Working-in-a-Virtual-Table/m-p/4291999#M170307</guid>
      <dc:creator>jimmyhua</dc:creator>
      <dc:date>2024-11-19T23:08:07Z</dc:date>
    </item>
    <item>
      <title>Re: Slicer selection not Working in a Virtual Table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Slicer-selection-not-Working-in-a-Virtual-Table/m-p/4294544#M170444</link>
      <description>&lt;P&gt;Thanks for the reply from&amp;nbsp;Poojara_D12.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="823061" data-lia-user-login="jimmyhua" class="lia-mention lia-mention-user"&gt;jimmyhua&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please use the following DAX formula:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Ranked Table Filter = 
VAR SelectedN = IF(HASONEVALUE('TopN Table'[Value]),MAX('TopN Table'[Value]),MIN('TopN Table'[Value])) 
RETURN
    FILTER(
        'RankedTable',
        [Rank] &amp;lt;= SelectedN
    )&lt;/LI-CODE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Zhu&lt;BR /&gt;Community Support Team&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;I&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/I&gt;, then please consider&amp;nbsp;&lt;I&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/I&gt;&amp;nbsp;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2024 05:35:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Slicer-selection-not-Working-in-a-Virtual-Table/m-p/4294544#M170444</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-21T05:35:04Z</dc:date>
    </item>
  </channel>
</rss>

