4 Replies Latest reply: Aug 26, 2015 6:27 AM by sunil kumar RSS

    Turning if statement into set analysis

      Hi guys how do I change an if statement like this:


      =if(if(operator= 'AAA' AND total_hours>0 , total_hours*resource_quantity, null())> 500, '>500', class(if(operator= 'AAA' AND total_hours>0 , total_hours*resource_quantity, null()), 30))



      Into a statement witouth if but with set analysis. I know how to use set analysis with other functsions, apart from if..

        • Re: Turning if statement into set analysis
          Tresesco B

          This is a misconception that all IFs can be replaced with set analysis. Try to share your business scenario, i.e. - how you would represent the report; using text box or any chart; if chart, what the dimension would be....

          • Re: Turning if statement into set analysis
            Michalina McAllister

            I think if you want to replace current expression with set analysis, you would have to create some flags in your load script (still using conditional IF statements) and then recall them in you set analysis. For example:


            in load script:
            if(operator= 'AAA' AND total_hours > 0, 1, 0) AS Flag1,


            expression with set analysis:

            sum({<Flag1 = 1>} total_hours*resource_quantity)


            As tresesco mentioned - stating that you can always replace IF with set analysis, is wrong. Split your IF statements into smaller chunks and create numeric flags in your load script. It will speed up your front end calculation.

            • Re: Turning if statement into set analysis

              I see. I purely wanted to make use of set analysis so that any selections that I make do not influence other graphs.


              I already make use of states, so that is not an option anymore since you can only assign one state per object.

              • Re: Turning if statement into set analysis
                sunil kumar

                Hi Dutchsky,

                Try like this if don't-want any other selections like Field1,Field2 below give example helps you i guess