<?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>Question Re: Filtering table measures with a dropdown list in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/filtering-table-measures-with-a-dropdown-list/qaa-p/13979467#M4898237</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/1852757"&gt;@Rick05&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I tried the same scenario filter measures in table I have below measure's as shown in table&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Yogeshwar_M_0-1736267485781.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/209153i0E0FE2276B3E392B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Yogeshwar_M_0-1736267485781.png" alt="Yogeshwar_M_0-1736267485781.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;2. I used below script on dropdown.&lt;/P&gt;&lt;P&gt;var selectedMeasure = Dropdown_3.getSelectedKey();&lt;BR /&gt;if(selectedMeasure ==="Quantity"){&lt;BR /&gt;Table_5.getDataSource().setDimensionFilter(Alias.MeasureDimension,["Quantity"]);&lt;BR /&gt;&lt;BR /&gt;}else{&lt;BR /&gt;&lt;BR /&gt;Table_5.getDataSource().setDimensionFilter(Alias.MeasureDimension,["Discount"])&lt;BR /&gt;;&lt;BR /&gt;Table_5.getDataSource().setDimensionFilter(Alias.MeasureDimension,["Profit"]);&lt;BR /&gt;Table_5.getDataSource().setDimensionFilter(Alias.MeasureDimension,["Sale"]);&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Yogeshwar_M_1-1736267615008.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/209154i40D99CFFE0BADF4C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Yogeshwar_M_1-1736267615008.png" alt="Yogeshwar_M_1-1736267615008.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;3. Its filter according to measures selection&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Yogeshwar_M_2-1736267833982.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/209158i9A0539B71720070E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Yogeshwar_M_2-1736267833982.png" alt="Yogeshwar_M_2-1736267833982.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;4. If I select Sale it will filter as per Sale's Measure&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Yogeshwar_M_3-1736267941459.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/209164iA3F38EDC7BA24073/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Yogeshwar_M_3-1736267941459.png" alt="Yogeshwar_M_3-1736267941459.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;OR&lt;/P&gt;&lt;P&gt;Same Scenario you can do with "Measure Input Control" you don't need to be write script it will work on both chart and table&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Yogeshwar_M_0-1736268631873.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/209180iB620BB744516068A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Yogeshwar_M_0-1736268631873.png" alt="Yogeshwar_M_0-1736268631873.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;2. Add Measure Input control and remove other measure's&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Yogeshwar_M_1-1736268813897.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/209187i7054CD67211D5304/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Yogeshwar_M_1-1736268813897.png" alt="Yogeshwar_M_1-1736268813897.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kindly upvote if you find it helpful!&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 07 Jan 2025 16:54:14 GMT</pubDate>
    <dc:creator>Yogeshwar_M</dc:creator>
    <dc:date>2025-01-07T16:54:14Z</dc:date>
    <item>
      <title>Filtering table measures with a dropdown list</title>
      <link>https://community.sap.com/t5/technology-q-a/filtering-table-measures-with-a-dropdown-list/qaq-p/13979216</link>
      <description>&lt;P&gt;&lt;LI-PRODUCT title="SAP Analytics Cloud" id="67838200100800006884"&gt;&lt;/LI-PRODUCT&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi I am trying to filter the measures of a table with a dropdown.&lt;BR /&gt;I have followed these two tutorials but it does not work.&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.sap.com/docs/SAP_ANALYTICS_CLOUD/00f68c2e08b941f081002fd3691d86a7/4dafe941002e45e7a9f5d0e4bf14151a.html?q=dropdown" target="_blank"&gt;Best Practice: Filter Table and Chart Through Dropdown (Single Selection) | SAP Help Portal&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.youtube.com/watch?v=FpSA5jDBleU" target="_blank"&gt;33. Filtering table through Dropdown in Analytics Application ( SAP Analytics Cloud) - YouTube&lt;/A&gt;&lt;/P&gt;&lt;P&gt;My script is as follows:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;OnInitialization:&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV&gt;var measures = Table.getDataSource().getMeasures();&lt;/DIV&gt;&lt;DIV&gt;//var datas = Table.getDataSource().getInfo();&lt;/DIV&gt;&lt;DIV&gt;// console.log(measures);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;var selectedKey = "";&lt;/DIV&gt;&lt;DIV&gt;if( measures.length &amp;gt; 0){&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;for (var i=0;i&amp;lt;measures.length;i++){&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Dropdown_4.addItem(measures[i].id,measures[i].description);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;if (selectedKey === "" &amp;amp;&amp;amp; i === 0) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;selectedKey = measures[i].id;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Dropdown_4.setSelectedKey(selectedKey);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;console.log(["selectedKey ", selectedKey]);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;console.log(["CurrentMeasure ", measures]);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&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;Utils.setMeasureFilter(selectedKey);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;Dropdown:&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;var selection = Dropdown_4.getSelectedKey();&lt;BR /&gt;Utils.setMeasureFilter(Dropdown_4.getSelectedKey());&lt;BR /&gt;console.log(selection);&lt;BR /&gt;// debugger;&lt;BR /&gt;//Table.getDataSource().refreshData();&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;setMeasureFilter (script object):&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;console.log(selectedId);&lt;/DIV&gt;&lt;DIV&gt;Table.getDataSource().removeDimensionFilter("NEWSTOCK");&lt;/DIV&gt;&lt;DIV&gt;if (CurrentMeasureFilterSelection !== ""){&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Chart_6.removeMember(Feed.ValueAxis, CurrentMeasureFilterSelection);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Table.getDataSource().setDimensionFilter("NEWSTOCK",selectedId);&lt;/DIV&gt;&lt;DIV&gt;Chart_6.addMember(Feed.ValueAxis, selectedId);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;My scriptobject does have a string argument with selectedId&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;my script variable looks like this:&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Rick05_0-1736254601160.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/209038i77B014F5FC0BAFEF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Rick05_0-1736254601160.png" alt="Rick05_0-1736254601160.png" /&gt;&lt;/span&gt;&lt;P&gt;My dataset name is NEWSTOCK and it has 6 measures.&lt;/P&gt;&lt;P&gt;The chart will change, but keeps on adding measures (I have fixed this in a problem were I only have charts another way). But the table will not change. The measures do appear in the dropdown and seem to be written right in the console.log().&lt;/P&gt;&lt;P&gt;I maybe think the problem lies with the value NEWSTOCK, this is the only point that differs from the tutorial that I see? Does anyone know what I am doing wrong?&lt;/P&gt;&lt;P&gt;Kind regards,&lt;BR /&gt;&lt;BR /&gt;Rick&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 13:07:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/filtering-table-measures-with-a-dropdown-list/qaq-p/13979216</guid>
      <dc:creator>Rick05</dc:creator>
      <dc:date>2025-01-07T13:07:55Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering table measures with a dropdown list</title>
      <link>https://community.sap.com/t5/technology-q-a/filtering-table-measures-with-a-dropdown-list/qaa-p/13979467#M4898237</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/1852757"&gt;@Rick05&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I tried the same scenario filter measures in table I have below measure's as shown in table&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Yogeshwar_M_0-1736267485781.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/209153i0E0FE2276B3E392B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Yogeshwar_M_0-1736267485781.png" alt="Yogeshwar_M_0-1736267485781.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;2. I used below script on dropdown.&lt;/P&gt;&lt;P&gt;var selectedMeasure = Dropdown_3.getSelectedKey();&lt;BR /&gt;if(selectedMeasure ==="Quantity"){&lt;BR /&gt;Table_5.getDataSource().setDimensionFilter(Alias.MeasureDimension,["Quantity"]);&lt;BR /&gt;&lt;BR /&gt;}else{&lt;BR /&gt;&lt;BR /&gt;Table_5.getDataSource().setDimensionFilter(Alias.MeasureDimension,["Discount"])&lt;BR /&gt;;&lt;BR /&gt;Table_5.getDataSource().setDimensionFilter(Alias.MeasureDimension,["Profit"]);&lt;BR /&gt;Table_5.getDataSource().setDimensionFilter(Alias.MeasureDimension,["Sale"]);&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Yogeshwar_M_1-1736267615008.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/209154i40D99CFFE0BADF4C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Yogeshwar_M_1-1736267615008.png" alt="Yogeshwar_M_1-1736267615008.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;3. Its filter according to measures selection&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Yogeshwar_M_2-1736267833982.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/209158i9A0539B71720070E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Yogeshwar_M_2-1736267833982.png" alt="Yogeshwar_M_2-1736267833982.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;4. If I select Sale it will filter as per Sale's Measure&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Yogeshwar_M_3-1736267941459.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/209164iA3F38EDC7BA24073/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Yogeshwar_M_3-1736267941459.png" alt="Yogeshwar_M_3-1736267941459.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;OR&lt;/P&gt;&lt;P&gt;Same Scenario you can do with "Measure Input Control" you don't need to be write script it will work on both chart and table&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Yogeshwar_M_0-1736268631873.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/209180iB620BB744516068A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Yogeshwar_M_0-1736268631873.png" alt="Yogeshwar_M_0-1736268631873.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;2. Add Measure Input control and remove other measure's&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Yogeshwar_M_1-1736268813897.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/209187i7054CD67211D5304/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Yogeshwar_M_1-1736268813897.png" alt="Yogeshwar_M_1-1736268813897.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kindly upvote if you find it helpful!&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 16:54:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/filtering-table-measures-with-a-dropdown-list/qaa-p/13979467#M4898237</guid>
      <dc:creator>Yogeshwar_M</dc:creator>
      <dc:date>2025-01-07T16:54:14Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering table measures with a dropdown list</title>
      <link>https://community.sap.com/t5/technology-q-a/filtering-table-measures-with-a-dropdown-list/qaa-p/13981219#M4898434</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/1700843"&gt;@Yogeshwar_M&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;This solved my problem, the script to filter measures of a table works.&lt;BR /&gt;&lt;BR /&gt;Kind regards,&lt;BR /&gt;&lt;BR /&gt;Rick&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2025 07:48:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/filtering-table-measures-with-a-dropdown-list/qaa-p/13981219#M4898434</guid>
      <dc:creator>Rick05</dc:creator>
      <dc:date>2025-01-09T07:48:53Z</dc:date>
    </item>
  </channel>
</rss>

