<?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: Adding a calculated measure to a dropdown selector in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/adding-a-calculated-measure-to-a-dropdown-selector/qaa-p/12761225#M4790443</link>
    <description>&lt;P&gt;Thank you for the response Nikhil! I should have provided a little more detail. Your method is good for populating all measures, which would include any calculations. However, I have quite a few measures in my model and would like the dropdown list to include only a select few of them, including a calculation. Is it possible to reference a specific calculated measure? Thank you!&lt;/P&gt;</description>
    <pubDate>Tue, 22 Aug 2023 13:48:12 GMT</pubDate>
    <dc:creator>mwickman</dc:creator>
    <dc:date>2023-08-22T13:48:12Z</dc:date>
    <item>
      <title>Adding a calculated measure to a dropdown selector</title>
      <link>https://community.sap.com/t5/technology-q-a/adding-a-calculated-measure-to-a-dropdown-selector/qaq-p/12761223</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
  &lt;P&gt;Can anyone tell me if it is possible to add a calculated measure to a list within a dropdown widget, in Analytics designer? If possible, can you provide the correct syntax. &lt;/P&gt;
  &lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2023 03:11:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/adding-a-calculated-measure-to-a-dropdown-selector/qaq-p/12761223</guid>
      <dc:creator>mwickman</dc:creator>
      <dc:date>2023-08-22T03:11:02Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a calculated measure to a dropdown selector</title>
      <link>https://community.sap.com/t5/technology-q-a/adding-a-calculated-measure-to-a-dropdown-selector/qaa-p/12761224#M4790442</link>
      <description>&lt;P&gt;&lt;SPAN class="mention-scrubbed"&gt;mwickman&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Something like below, Assuming Table_1 is the table widget and Drodpwn_1 is the dropdown. You can place this code on initialization event or as per your need. This adds both calculated measure from model and story&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;var measure = Table_1.getDataSource().getMeasures();
console.log(measure);

for (var i=0;i&amp;lt;measure.length;i++)
	{
	Dropdown_1.addItem(measure[i].id,measure[i].description);
	}&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Story&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2198950-image.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2198951-image.png" /&gt;&lt;/P&gt;&lt;P&gt;Hope this helps !!&lt;/P&gt;&lt;P&gt;Nikhil&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2023 04:13:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/adding-a-calculated-measure-to-a-dropdown-selector/qaa-p/12761224#M4790442</guid>
      <dc:creator>N1kh1l</dc:creator>
      <dc:date>2023-08-22T04:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a calculated measure to a dropdown selector</title>
      <link>https://community.sap.com/t5/technology-q-a/adding-a-calculated-measure-to-a-dropdown-selector/qaa-p/12761225#M4790443</link>
      <description>&lt;P&gt;Thank you for the response Nikhil! I should have provided a little more detail. Your method is good for populating all measures, which would include any calculations. However, I have quite a few measures in my model and would like the dropdown list to include only a select few of them, including a calculation. Is it possible to reference a specific calculated measure? Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2023 13:48:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/adding-a-calculated-measure-to-a-dropdown-selector/qaa-p/12761225#M4790443</guid>
      <dc:creator>mwickman</dc:creator>
      <dc:date>2023-08-22T13:48:12Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a calculated measure to a dropdown selector</title>
      <link>https://community.sap.com/t5/technology-q-a/adding-a-calculated-measure-to-a-dropdown-selector/qaa-p/12761226#M4790444</link>
      <description>&lt;P&gt;&lt;SPAN class="mention-scrubbed"&gt;mwickman&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;There can be 2 approaches which I can think of and they depend on how long is the list of  measures intended to be added to dropdown. If they are handful, they can be just added manually to the Dropdown widget in the configuration. If the list is a bit long an array variable can be declared to store the list and then a check can be made before assigning them to the dropdown. Below is the adjusted code and I am adding a simple measure, a model level calculated measure and story calculated measure&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Dropdown_1.removeAllItems();

var measure = Table_1.getDataSource().getMeasures();
console.log(measure);
var measure_list = ["Flow_Opening_LC","Flow_Total_LC","28757990-1719-4620-3507-315970181928"]; // Add all measure intended here

for (var i=0;i&amp;lt;measure.length;i++)
	{
		if(measure_list.indexOf(measure[i].id) !== -1 &amp;amp;&amp;amp; measure[i].id)
			{
	Dropdown_1.addItem(measure[i].id,measure[i].description);
	}
	}&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2198981-image.png" /&gt;&lt;/P&gt;&lt;P&gt; Hope this helps !!&lt;/P&gt;&lt;P&gt;Nikhil&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2023 15:49:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/adding-a-calculated-measure-to-a-dropdown-selector/qaa-p/12761226#M4790444</guid>
      <dc:creator>N1kh1l</dc:creator>
      <dc:date>2023-08-22T15:49:00Z</dc:date>
    </item>
  </channel>
</rss>

