<?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 Need help with data formats in set analysis formula in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Need-help-with-data-formats-in-set-analysis-formula/m-p/1274179#M848931</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13.3333px;"&gt;Hi all,&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;I have a set analysis formula that is used to get the trend for last 12 months data.&lt;SPAN style="font-size: 13.3333px;"&gt;However, I am unable to convert these to number or percent formats. I have field 'data type' which has the data type (number or percent) for the selected KPI. I used the below formula to convert the data formats. But gives me only the un-formatted (only the number format) results.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;KPI_Trend =if (DataType = 'Percent', Num( Avg({1&amp;lt;PeriodType = p(PeriodType), EntityName = p(EntityName), MeasureName = p(MeasureName) ,MeasureDomain = p(MeasureDomain), PeriodKey_End_Date = {"$(='&amp;gt;' &amp;amp; Date(AddMonths(Max(PeriodKey_End_Date), -12), 'YYYY-MM-DD') &amp;amp; '&amp;lt;=' &amp;amp; Date(AddMonths(Max(PeriodKey_End_Date),1), 'YYYY-MM-DD'))"} &amp;gt;} KPI_Value),'##0.00%'),&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&amp;nbsp; if( DataType = 'Number', Num(Avg({1&amp;lt;PeriodType = p(PeriodType), EntityName = p(EntityName), MeasureName = p(MeasureName) ,MeasureDomain = p(MeasureDomain), PeriodKey_End_Date = {"$(='&amp;gt;' &amp;amp; Date(AddMonths(Max(PeriodKey_End_Date), -12), 'YYYY-MM-DD') &amp;amp; '&amp;lt;=' &amp;amp; Date(AddMonths(Max(PeriodKey_End_Date),1), 'YYYY-MM-DD'))"} &amp;gt;} KPI_Value),'###0.00') ,&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp; Avg({1&amp;lt;PeriodType = p(PeriodType), EntityName = p(EntityName), MeasureName = p(MeasureName) ,MeasureDomain = p(MeasureDomain), PeriodKey_End_Date = {"$(='&amp;gt;' &amp;amp; Date(AddMonths(Max(PeriodKey_End_Date), -12), 'YYYY-MM-DD') &amp;amp; '&amp;lt;=' &amp;amp; Date(AddMonths(Max(PeriodKey_End_Date),1), 'YYYY-MM-DD'))"} &amp;gt;} KPI_Value)&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&amp;nbsp; ))&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Tried the below way as well,but no luck. Created 2 variables and used these in the formula.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;vKPI_Percent =&amp;nbsp;&amp;nbsp; Num(Avg({1&amp;lt;PeriodType = p(PeriodType), EntityName = p(EntityName), MeasureName = p(MeasureName) ,MeasureDomain = p(MeasureDomain), PeriodKey_End_Date = {"$(='&amp;gt;' &amp;amp; Date(AddMonths(Max(PeriodKey_End_Date), -12), 'YYYY-MM-DD') &amp;amp; '&amp;lt;=' &amp;amp; Date(AddMonths(Max(PeriodKey_End_Date),1), 'YYYY-MM-DD'))"} &amp;gt;} KPI_Value),'##0.00%' )&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;vKPI_Number =&amp;nbsp; Num(Avg({1&amp;lt;PeriodType = p(PeriodType), EntityName = p(EntityName), MeasureName = p(MeasureName) ,MeasureDomain = p(MeasureDomain), PeriodKey_End_Date = {"$(='&amp;gt;' &amp;amp; Date(AddMonths(Max(PeriodKey_End_Date), -12), 'YYYY-MM-DD') &amp;amp; '&amp;lt;=' &amp;amp; Date(AddMonths(Max(PeriodKey_End_Date),1), 'YYYY-MM-DD'))"} &amp;gt;} KPI_Value),'##0.00' )&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;vKPI_selected =&amp;nbsp; if (DataType = 'Percent', $(&lt;SPAN style="font-size: 13.3333px;"&gt;vKPI_Percent&lt;/SPAN&gt;), &lt;SPAN style="font-size: 13.3333px;"&gt; $(&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;vKPI_Number)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt; Any suggestions, please&amp;nbsp; ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-11-25T16:16:04Z</dc:date>
    <item>
      <title>Need help with data formats in set analysis formula</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-data-formats-in-set-analysis-formula/m-p/1274179#M848931</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13.3333px;"&gt;Hi all,&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;I have a set analysis formula that is used to get the trend for last 12 months data.&lt;SPAN style="font-size: 13.3333px;"&gt;However, I am unable to convert these to number or percent formats. I have field 'data type' which has the data type (number or percent) for the selected KPI. I used the below formula to convert the data formats. But gives me only the un-formatted (only the number format) results.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;KPI_Trend =if (DataType = 'Percent', Num( Avg({1&amp;lt;PeriodType = p(PeriodType), EntityName = p(EntityName), MeasureName = p(MeasureName) ,MeasureDomain = p(MeasureDomain), PeriodKey_End_Date = {"$(='&amp;gt;' &amp;amp; Date(AddMonths(Max(PeriodKey_End_Date), -12), 'YYYY-MM-DD') &amp;amp; '&amp;lt;=' &amp;amp; Date(AddMonths(Max(PeriodKey_End_Date),1), 'YYYY-MM-DD'))"} &amp;gt;} KPI_Value),'##0.00%'),&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&amp;nbsp; if( DataType = 'Number', Num(Avg({1&amp;lt;PeriodType = p(PeriodType), EntityName = p(EntityName), MeasureName = p(MeasureName) ,MeasureDomain = p(MeasureDomain), PeriodKey_End_Date = {"$(='&amp;gt;' &amp;amp; Date(AddMonths(Max(PeriodKey_End_Date), -12), 'YYYY-MM-DD') &amp;amp; '&amp;lt;=' &amp;amp; Date(AddMonths(Max(PeriodKey_End_Date),1), 'YYYY-MM-DD'))"} &amp;gt;} KPI_Value),'###0.00') ,&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp; Avg({1&amp;lt;PeriodType = p(PeriodType), EntityName = p(EntityName), MeasureName = p(MeasureName) ,MeasureDomain = p(MeasureDomain), PeriodKey_End_Date = {"$(='&amp;gt;' &amp;amp; Date(AddMonths(Max(PeriodKey_End_Date), -12), 'YYYY-MM-DD') &amp;amp; '&amp;lt;=' &amp;amp; Date(AddMonths(Max(PeriodKey_End_Date),1), 'YYYY-MM-DD'))"} &amp;gt;} KPI_Value)&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&amp;nbsp; ))&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Tried the below way as well,but no luck. Created 2 variables and used these in the formula.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;vKPI_Percent =&amp;nbsp;&amp;nbsp; Num(Avg({1&amp;lt;PeriodType = p(PeriodType), EntityName = p(EntityName), MeasureName = p(MeasureName) ,MeasureDomain = p(MeasureDomain), PeriodKey_End_Date = {"$(='&amp;gt;' &amp;amp; Date(AddMonths(Max(PeriodKey_End_Date), -12), 'YYYY-MM-DD') &amp;amp; '&amp;lt;=' &amp;amp; Date(AddMonths(Max(PeriodKey_End_Date),1), 'YYYY-MM-DD'))"} &amp;gt;} KPI_Value),'##0.00%' )&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;vKPI_Number =&amp;nbsp; Num(Avg({1&amp;lt;PeriodType = p(PeriodType), EntityName = p(EntityName), MeasureName = p(MeasureName) ,MeasureDomain = p(MeasureDomain), PeriodKey_End_Date = {"$(='&amp;gt;' &amp;amp; Date(AddMonths(Max(PeriodKey_End_Date), -12), 'YYYY-MM-DD') &amp;amp; '&amp;lt;=' &amp;amp; Date(AddMonths(Max(PeriodKey_End_Date),1), 'YYYY-MM-DD'))"} &amp;gt;} KPI_Value),'##0.00' )&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;vKPI_selected =&amp;nbsp; if (DataType = 'Percent', $(&lt;SPAN style="font-size: 13.3333px;"&gt;vKPI_Percent&lt;/SPAN&gt;), &lt;SPAN style="font-size: 13.3333px;"&gt; $(&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;vKPI_Number)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt; Any suggestions, please&amp;nbsp; ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-data-formats-in-set-analysis-formula/m-p/1274179#M848931</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with data formats in set analysis formula</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-data-formats-in-set-analysis-formula/m-p/1274180#M848932</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you use the &lt;STRONG&gt;NUM() &lt;/STRONG&gt;function without using it in a variable&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Mar 2017 12:45:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-data-formats-in-set-analysis-formula/m-p/1274180#M848932</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-13T12:45:40Z</dc:date>
    </item>
  </channel>
</rss>

