<?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 Switch TOPN with Field Parameters in Quick Measures Gallery</title>
    <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Switch-TOPN-with-Field-Parameters/m-p/2817469#M899</link>
    <description>&lt;H1&gt;TOPN with Field Parameters&lt;/H1&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Problem Statement: Field parameter has been used to create Axis/Dimension slicer. We would like TOPN to work based on Axis. We have two columns Brand and Category with a measure, net. And the Field parameter is created on Brand and Category. Select any one of these and the net’s topn of that should be shown based on that.&amp;nbsp;&lt;/P&gt;
&lt;FIGURE&gt;&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/FIGURE&gt;
&lt;P&gt;Model: I am using the standard sales model, I and using for all my videos and blogs. Sales fact with a key measure [net], joined with dimensions: Item, Geography, Date, and Customer.&lt;/P&gt;
&lt;FIGURE&gt;&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/FIGURE&gt;
&lt;P&gt;Solution:&lt;/P&gt;
&lt;P&gt;Created a field parameter on Brand and category from the Item Dimension. Refer to this blog to learn how to create field parameters: &lt;A href="https://amitchandak.medium.com/power-bi-field-parameters-a-quick-way-for-dynamic-visuals-fc4095ae9afd" target="_blank" rel="nofollow noopener" data-href="https://amitchandak.medium.com/power-bi-field-parameters-a-quick-way-for-dynamic-visuals-fc4095ae9afd"&gt;https://amitchandak.medium.com/power-bi-field-parameters-a-quick-way-for-dynamic-visuals-fc4095ae9afd&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;This is the table code&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Parameter = {
    ("Brand", NAMEOF('Item'[Brand]), 0),
    ("Category", NAMEOF('Item'[Category]), 1)
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Created a selectedvalue for the Axis parameter. As a direct selectedvalue not supported on the Field Parameter column, used this code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Selected Parameter = maxx(filter(Parameter ,Parameter[Parameter Order] = SELECTEDVALUE(Parameter[Parameter Order])), Parameter[Parameter])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Created a TOPN measure like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;TOP2 Quick = SWITCH([Selected Parameter], "Brand" , CALCULATE([Net], TOPN(2,ALLSELECTED('Item'[Brand]), [Net],DESC), values('Item'[Brand])) ,
CALCULATE([Net], TOPN(2,ALLSELECTED('Item'[Category]), [Net],DESC), values('Item'[Category]))
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you select Category&amp;nbsp;&lt;/P&gt;
&lt;FIGURE&gt;&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/FIGURE&gt;
&lt;P&gt;When you select Brand&lt;/P&gt;
&lt;FIGURE&gt;&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/FIGURE&gt;
&lt;P&gt;You can find more details on the &lt;A href="https://amitchandak.medium.com/switch-topn-with-field-parameters-299a0ae3725f" target="_self"&gt;blog&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The file is attached.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-selectable-paragraph=""&gt;Find all my Medium blogs&amp;nbsp;&lt;A href="https://amitchandak.medium.com/" target="_blank" rel="noopener nofollow noreferrer"&gt;here&lt;/A&gt;&lt;/P&gt;
&lt;P data-selectable-paragraph=""&gt;Click&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Data-Stories-Gallery/Blog-Analysis/m-p/1265567#M4403" target="_blank" rel="noopener ugc"&gt;Here&lt;/A&gt;&amp;nbsp;to access all my blogs and videos in a jiffy via an exclusive visual glossary using Power BI.&lt;BR /&gt;Please like, share, and comment on these. Your suggestions on improvement, challenges, and new topics will help me explore more.&lt;/P&gt;
&lt;P data-selectable-paragraph=""&gt;You Can watch my Power BI Tutorial Series on&amp;nbsp;&lt;A href="https://www.youtube.com/c/Amitchandak?sub_confirmation=1" target="_blank" rel="noopener ugc nofollow noreferrer"&gt;My Channel&lt;/A&gt;, Subscribe, Like, and share&lt;/P&gt;
&lt;P data-selectable-paragraph=""&gt;&lt;A href="https://www.youtube.com/watch?v=wvsAzTqSDVg&amp;amp;list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb" target="_blank" rel="noopener ugc nofollow noreferrer"&gt;Master Power BI&lt;/A&gt;&lt;/P&gt;
&lt;P data-selectable-paragraph=""&gt;&lt;A href="https://www.youtube.com/watch?v=59PUFuuCrbY&amp;amp;list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L" target="_blank" rel="noopener ugc nofollow noreferrer"&gt;Expertise Power BI&lt;/A&gt;&lt;/P&gt;
&lt;P data-selectable-paragraph=""&gt;&lt;A href="https://www.youtube.com/watch?v=tAmg00Wf_cw&amp;amp;list=PLPaNVDMhUXGYzjFASXjdY7GNoFxvlkR54" target="_blank" rel="noopener ugc nofollow noreferrer"&gt;Power BI For Tableau User&lt;/A&gt;&lt;/P&gt;
&lt;P data-selectable-paragraph=""&gt;&lt;A href="https://www.youtube.com/watch?v=WlvQ_SGy4iA&amp;amp;list=PLPaNVDMhUXGZNyKU0PgG2g3P0c6CPjMnj" target="_blank" rel="noopener ugc nofollow noreferrer"&gt;DAX for SQL Users&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 24 Nov 2022 09:04:10 GMT</pubDate>
    <dc:creator>amitchandak</dc:creator>
    <dc:date>2022-11-24T09:04:10Z</dc:date>
    <item>
      <title>Switch TOPN with Field Parameters</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Switch-TOPN-with-Field-Parameters/m-p/2817469#M899</link>
      <description>&lt;H1&gt;TOPN with Field Parameters&lt;/H1&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Problem Statement: Field parameter has been used to create Axis/Dimension slicer. We would like TOPN to work based on Axis. We have two columns Brand and Category with a measure, net. And the Field parameter is created on Brand and Category. Select any one of these and the net’s topn of that should be shown based on that.&amp;nbsp;&lt;/P&gt;
&lt;FIGURE&gt;&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/FIGURE&gt;
&lt;P&gt;Model: I am using the standard sales model, I and using for all my videos and blogs. Sales fact with a key measure [net], joined with dimensions: Item, Geography, Date, and Customer.&lt;/P&gt;
&lt;FIGURE&gt;&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/FIGURE&gt;
&lt;P&gt;Solution:&lt;/P&gt;
&lt;P&gt;Created a field parameter on Brand and category from the Item Dimension. Refer to this blog to learn how to create field parameters: &lt;A href="https://amitchandak.medium.com/power-bi-field-parameters-a-quick-way-for-dynamic-visuals-fc4095ae9afd" target="_blank" rel="nofollow noopener" data-href="https://amitchandak.medium.com/power-bi-field-parameters-a-quick-way-for-dynamic-visuals-fc4095ae9afd"&gt;https://amitchandak.medium.com/power-bi-field-parameters-a-quick-way-for-dynamic-visuals-fc4095ae9afd&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;This is the table code&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Parameter = {
    ("Brand", NAMEOF('Item'[Brand]), 0),
    ("Category", NAMEOF('Item'[Category]), 1)
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Created a selectedvalue for the Axis parameter. As a direct selectedvalue not supported on the Field Parameter column, used this code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Selected Parameter = maxx(filter(Parameter ,Parameter[Parameter Order] = SELECTEDVALUE(Parameter[Parameter Order])), Parameter[Parameter])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Created a TOPN measure like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;TOP2 Quick = SWITCH([Selected Parameter], "Brand" , CALCULATE([Net], TOPN(2,ALLSELECTED('Item'[Brand]), [Net],DESC), values('Item'[Brand])) ,
CALCULATE([Net], TOPN(2,ALLSELECTED('Item'[Category]), [Net],DESC), values('Item'[Category]))
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you select Category&amp;nbsp;&lt;/P&gt;
&lt;FIGURE&gt;&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/FIGURE&gt;
&lt;P&gt;When you select Brand&lt;/P&gt;
&lt;FIGURE&gt;&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/FIGURE&gt;
&lt;P&gt;You can find more details on the &lt;A href="https://amitchandak.medium.com/switch-topn-with-field-parameters-299a0ae3725f" target="_self"&gt;blog&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The file is attached.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-selectable-paragraph=""&gt;Find all my Medium blogs&amp;nbsp;&lt;A href="https://amitchandak.medium.com/" target="_blank" rel="noopener nofollow noreferrer"&gt;here&lt;/A&gt;&lt;/P&gt;
&lt;P data-selectable-paragraph=""&gt;Click&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Data-Stories-Gallery/Blog-Analysis/m-p/1265567#M4403" target="_blank" rel="noopener ugc"&gt;Here&lt;/A&gt;&amp;nbsp;to access all my blogs and videos in a jiffy via an exclusive visual glossary using Power BI.&lt;BR /&gt;Please like, share, and comment on these. Your suggestions on improvement, challenges, and new topics will help me explore more.&lt;/P&gt;
&lt;P data-selectable-paragraph=""&gt;You Can watch my Power BI Tutorial Series on&amp;nbsp;&lt;A href="https://www.youtube.com/c/Amitchandak?sub_confirmation=1" target="_blank" rel="noopener ugc nofollow noreferrer"&gt;My Channel&lt;/A&gt;, Subscribe, Like, and share&lt;/P&gt;
&lt;P data-selectable-paragraph=""&gt;&lt;A href="https://www.youtube.com/watch?v=wvsAzTqSDVg&amp;amp;list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb" target="_blank" rel="noopener ugc nofollow noreferrer"&gt;Master Power BI&lt;/A&gt;&lt;/P&gt;
&lt;P data-selectable-paragraph=""&gt;&lt;A href="https://www.youtube.com/watch?v=59PUFuuCrbY&amp;amp;list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L" target="_blank" rel="noopener ugc nofollow noreferrer"&gt;Expertise Power BI&lt;/A&gt;&lt;/P&gt;
&lt;P data-selectable-paragraph=""&gt;&lt;A href="https://www.youtube.com/watch?v=tAmg00Wf_cw&amp;amp;list=PLPaNVDMhUXGYzjFASXjdY7GNoFxvlkR54" target="_blank" rel="noopener ugc nofollow noreferrer"&gt;Power BI For Tableau User&lt;/A&gt;&lt;/P&gt;
&lt;P data-selectable-paragraph=""&gt;&lt;A href="https://www.youtube.com/watch?v=WlvQ_SGy4iA&amp;amp;list=PLPaNVDMhUXGZNyKU0PgG2g3P0c6CPjMnj" target="_blank" rel="noopener ugc nofollow noreferrer"&gt;DAX for SQL Users&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Nov 2022 09:04:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Switch-TOPN-with-Field-Parameters/m-p/2817469#M899</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-11-24T09:04:10Z</dc:date>
    </item>
  </channel>
</rss>

