<?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 Generate multiple calculated dimensions based on loop in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Generate-multiple-calculated-dimensions-based-on-loop/m-p/1747736#M57477</link>
    <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/46628"&gt;@sunny_talwar&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/22245"&gt;@swuehl&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi Sunny/Stefan,&lt;/P&gt;&lt;P&gt;I was hoping one of you could help me with this one. I have a table with the following fields:&lt;/P&gt;&lt;P&gt;opp_id, pop_start_date, pop_end_date, expected_revenue&lt;/P&gt;&lt;P&gt;The goal is to generate one calculated dimension for each month. The result is a number. I have successfully created the logic for one month, but I am having difficulty in converting to some sort of a loop so I don't have to have this logic pasted 10s of times for all the possible months.&amp;nbsp; I know that I need to utilize some MIN and MAX variables to establish the date range and then loop those variables through this logic. But how do I dynamically generate each dimension so that it too increases by 1 month each time?&amp;nbsp;&lt;/P&gt;&lt;P&gt;[Period_of_Performance_calculate]:&lt;BR /&gt;Load *,&lt;/P&gt;&lt;P&gt;IF('9/1/2018'&amp;lt;= (PoP_Start__c - day(PoP_Start__c)) or '9/1/2018'&amp;gt;monthend(PoP_End__c,0),null(),&lt;BR /&gt;RangeMax(rangemin(addmonths('9/1/2018',1)-PoP_Start__c, addmonths('9/1/2018',1)-'9/1/2018', PoP_End__c-'9/1/2018'+1,PoP_End__c-PoP_Start__c+1),0)&lt;BR /&gt;*[Expected_Revenue__c]&lt;BR /&gt;/(PoP_End__c-PoP_Start__c+1)) as [Sep-18] //this would increment each time so the next dimension would be [Oct-18] then [Nov-18] all the way until the MAX(pop_end_date).&amp;nbsp;&lt;/P&gt;&lt;P&gt;Resident [Period_of_Performance__c];&lt;BR /&gt;Drop Table [Period_of_Performance__c];&lt;BR /&gt;Rename table [Period_of_Performance_calculate] to [Period_of_Performance__c];&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 01:22:08 GMT</pubDate>
    <dc:creator>benwashburne</dc:creator>
    <dc:date>2024-11-16T01:22:08Z</dc:date>
    <item>
      <title>Generate multiple calculated dimensions based on loop</title>
      <link>https://community.qlik.com/t5/App-Development/Generate-multiple-calculated-dimensions-based-on-loop/m-p/1747736#M57477</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/46628"&gt;@sunny_talwar&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/22245"&gt;@swuehl&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi Sunny/Stefan,&lt;/P&gt;&lt;P&gt;I was hoping one of you could help me with this one. I have a table with the following fields:&lt;/P&gt;&lt;P&gt;opp_id, pop_start_date, pop_end_date, expected_revenue&lt;/P&gt;&lt;P&gt;The goal is to generate one calculated dimension for each month. The result is a number. I have successfully created the logic for one month, but I am having difficulty in converting to some sort of a loop so I don't have to have this logic pasted 10s of times for all the possible months.&amp;nbsp; I know that I need to utilize some MIN and MAX variables to establish the date range and then loop those variables through this logic. But how do I dynamically generate each dimension so that it too increases by 1 month each time?&amp;nbsp;&lt;/P&gt;&lt;P&gt;[Period_of_Performance_calculate]:&lt;BR /&gt;Load *,&lt;/P&gt;&lt;P&gt;IF('9/1/2018'&amp;lt;= (PoP_Start__c - day(PoP_Start__c)) or '9/1/2018'&amp;gt;monthend(PoP_End__c,0),null(),&lt;BR /&gt;RangeMax(rangemin(addmonths('9/1/2018',1)-PoP_Start__c, addmonths('9/1/2018',1)-'9/1/2018', PoP_End__c-'9/1/2018'+1,PoP_End__c-PoP_Start__c+1),0)&lt;BR /&gt;*[Expected_Revenue__c]&lt;BR /&gt;/(PoP_End__c-PoP_Start__c+1)) as [Sep-18] //this would increment each time so the next dimension would be [Oct-18] then [Nov-18] all the way until the MAX(pop_end_date).&amp;nbsp;&lt;/P&gt;&lt;P&gt;Resident [Period_of_Performance__c];&lt;BR /&gt;Drop Table [Period_of_Performance__c];&lt;BR /&gt;Rename table [Period_of_Performance_calculate] to [Period_of_Performance__c];&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 01:22:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Generate-multiple-calculated-dimensions-based-on-loop/m-p/1747736#M57477</guid>
      <dc:creator>benwashburne</dc:creator>
      <dc:date>2024-11-16T01:22:08Z</dc:date>
    </item>
    <item>
      <title>Re: Generate multiple calculated dimensions based on loop</title>
      <link>https://community.qlik.com/t5/App-Development/Generate-multiple-calculated-dimensions-based-on-loop/m-p/1747763#M57485</link>
      <description>&lt;P&gt;Not entirely sure I understand, would you be able to elaborate a little more.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:46:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Generate-multiple-calculated-dimensions-based-on-loop/m-p/1747763#M57485</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2020-09-28T14:46:48Z</dc:date>
    </item>
    <item>
      <title>Re: Generate multiple calculated dimensions based on loop</title>
      <link>https://community.qlik.com/t5/App-Development/Generate-multiple-calculated-dimensions-based-on-loop/m-p/1747772#M57487</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/46628"&gt;@sunny_talwar&lt;/a&gt;&amp;nbsp; Sure thing.&lt;/P&gt;&lt;P&gt;I've attached an export of what I am trying to create. Imagine there are $$ values in the expected_revenue column. The column labelled 'Sep-18' stands for September-2018.&amp;nbsp; The values in this column are derived from the formula below (they show the amount of revenue you'd expect to collect in that month). I need to create this Month Year field for all the months between the PoP_Start and PoP End dates. As state, the value in this Month Year field is derived from the formula below. However, it is a static formula. Therefore, I would need to copy, paste, and update the date fields for each month within the range (9/1/2018, 10/1/2018, 11/1/2018, etc etc) in order to create each of the Year Month Dimensions needed.&amp;nbsp; I need to find a smarter, more optimized way to do this. I assume it involves generating a variable list for all the possible months in range and then looping the statement below, I just have no idea where to begin.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;IF('9/1/2018'&amp;lt;= (PoP_Start__c - day(PoP_Start__c)) or '9/1/2018'&amp;gt;monthend(PoP_End__c,0),null(),&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;RangeMax(rangemin(addmonths('9/1/2018',1)-PoP_Start__c, addmonths('9/1/2018',1)-'9/1/2018', PoP_End__c-'9/1/2018'+1,PoP_End__c-PoP_Start__c+1),0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;*[Expected_Revenue__c]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;/(PoP_End__c-PoP_Start__c+1)) as SEP-18&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:18:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Generate-multiple-calculated-dimensions-based-on-loop/m-p/1747772#M57487</guid>
      <dc:creator>benwashburne</dc:creator>
      <dc:date>2020-09-28T15:18:12Z</dc:date>
    </item>
  </channel>
</rss>

