8 Replies Latest reply: May 9, 2013 10:23 AM by Gysbert Wassenaar RSS

    Please Help

      Hi,

       

       

      I'm struggling with an IF-condition that I can't get to work in my tabell. I created a variabel called vAcceptedCurrentYearDirectNoMissing that works fine when I use it in my expression: $(vAcceptedCurrentYearDirectNoMissing).

       

       

      But when I put it in my if-condition (see underneath) and use it in my expression it doesn't seem to work.

       

      if(GetCurrentField([C_CampSales]) = 'NameInsurance',

      $(vAcceptedCurrentYearDirectNoMissing))

       

       

      Can someone please help me with this?

       

       

      Regards,

      Johan

        • Re: Please Help
          Vishwaranjan Kumar

          try this

           

          sum({$<[C_CampSales] = {'NameInsurance'}>}$(vAcceptedCurrentYearDirectNoMissing))

           

          then select the data(that is NameInsurance) of [C_CampSales] field.

           

           

          or alsso try this

           

          if([C_CampSales] = 'NameInsurance',$(vAcceptedCurrentYearDirectNoMissing))

            • Re: Please Help

              Thanks vishwaranjan, but unfortunately it didn't work.

               

               

              C_CampSales is a group that includes two dimensions: NameInsurance and campaign.

               

               

              I would like to be able to switch between these dimensions in my table.

               

               

              It will also be a seperate expressions for each dimension:

               

              if(GetCurrentField([C_CampSales]) = 'NameInsurance',

              $(vAcceptedCurrentYearDirectNoMissing),

              $(vAcceptedCurrentYearDirect))

               

               

              Is that possible?

            • Re: Please Help
              Gysbert Wassenaar

              If C_CampSales is a field then try:

               

              if(C_CampSales='NameInsurance', $(vAcceptedCurrentYearDirectNoMissing))

               

               

              But if C_CampSales is a cylcic group or a drilldown group try:

               

              if(GetCurrentField(C_CampSales) = 'NameInsurance', $(vAcceptedCurrentYearDirectNoMissing))

                • Re: Please Help

                  That's right it's a cyclic group and I tried:

                  if(GetCurrentField(C_CampSales) = 'NameInsurance', $(vAcceptedCurrentYearDirectNoMissing))

                   

                   

                  but it's not working.

                   

                   

                  I have tried GetCurrentField(C_CampSales) in a text object and it gives me NameInsurance

                  I also tried vAcceptedCurrentYearDirectNoMissing as an expression and it works fine

                    • Re: Please Help
                      Gysbert Wassenaar

                      Perhaps the expression in your variable needs a dimension to work. The technique works for me. See attached example.

                        • Re: Please Help

                          thanks Gysbert, but I can't get it to work

                           

                          This is what I'm working with.

                           

                          Variables:

                          vAcceptedCurrentYearDirect= sum( {$<[CurrentYear] = {1}, TypeOfInsuranceCD = {1}, Campaign = {[Name1], [Name2], [Name3]} >} NoOfSales)

                           

                          vAcceptedCurrentYearDirectNoMissing = sum( {$<[CurrentYear] = {1}, TypeOfInsuranceCD = {1}, NameInsurance = {[Name1], [Name2], [Name3]} >} NoOfSales)

                           

                          Then I have a table where I want Salesman and campaign to be a group as dim.

                           

                          Expression:

                           

                          if(GetCurrentField(C_CampSales) = 'NameInsurance',

                          $(vAcceptedCurrentYearDirectNoMissing),

                          $(vAcceptedCurrentYearDirect))

                           

                          I'm I missing a dimension somewhere?

                            • Re: Please Help
                              Gysbert Wassenaar

                              This doesn't make sense to me: Campaign = {[Name1], [Name2], [Name3]}. Same for NameInsurance = {[Name1], [Name2], [Name3]}. Unless [Name1] is really something like 'ThisIsAString' then those set modifiers would almost certainly make sure no record matches.

                               

                              If Name1, Name2 and Name3 are fields then those are you're missing dimensions. You won't get a result unless only one value is selected (or possible) in Name1 and only one value is selected (or possible) in Name2 and only one value is selected (or possible) in Name3.

                      • Re: Please Help

                        Hi,

                        what is the expression in your variable (vAcceptedCurrentYearDirectNoMissing). If it starts with equal sigh (=) delete it.When the expression in a variable definition starts with equal sign the variable gets calculated globally.

                         

                        Yani