4 Replies Latest reply: May 4, 2010 12:34 PM by rahul_tyagi RSS

    Problem Using Set Analysis

      Dear All,


      Sum({$<MonthNameSort={'$(vLast6YearMonth)'},[Company Type]={'OWN'},[Sales Type]={'G ORDER'}>} Qty)

      i am using the above set analysis expression to calculate a value.But it is not working

      My monthNameSort is the field which is made by using monthname function on the Date and give the values e.g Apr 2010 , Mar 2010 and vLast6YearMonth is the variable which is addmonths(MAX(MonthNameSort),-6) so i want want to select a value for the previous 6th month.

      and i use Sum({$<MonthNameSort={">=$(vLast6YearMonth)"},[Company Type]={'OWN'},[Sales Type]={'G ORDER'}>} (Qty)/12) then it waorks fine and gives the sum for last six months

      but the above first expression is not working where i want to calculate the value for only the last 6th month.

      Can any one suggest what is wrong in it.


      Thanks in advance.






        • Problem Using Set Analysis

          What is the format of the variable being spliced into the Set Analysis. If its not coming out as something QV understands as a numeric value then the >= will not work against it. Try outputing your expression to a Text Object to see how the code looks with the variable value in the expression.

          Also you may want to post a small sample app, or describe "not working." Are you getting null, the wrong value, or an error message?

            • Problem Using Set Analysis

              When i am using >= it is working but when i just want to calculate the value for only the last 6th month for which i have declared the variable " vLast6YearMonth" then it is not working . When using my expression in textbox i.e

              Sum({$<MonthNameSort={'$(vLast6YearMonth)'},[Company Type]={'OWN'},[Sales Type]={'G ORDER'}>} Qty)

              it is giving zero as output and format of my variable is DD/MM/YYYY eg 01/03/2010





                • Problem Using Set Analysis


                  Have you verified that your first formula provides correct results?

                  Is your MonthNameSort a date value?

                  Encountered the problem that in SET expressions the date needs to be a string according to the specified date settings. Can your try to replace vLast6YearMonth with a string value e.g. 'Apr 2010' and verify that you get correct results?