2 Replies Latest reply on Jun 13, 2016 11:17 AM by harris.tsr

    How to build a statement for specific scenarios?

    harris.tsr

      Hi,

       

      I want to create a statement in a calculation where based on the value of a field it will give a different outcome/value. The scenario I want to translate in Tableau terms is that if the field "ISPSRASSIGNED" in my datasource is TRUE, then I want to take the value of the field PSR_SYC1 or PSR_SYC2 or PSR_SYC3. The categorisation of PSR_SYC (1,2,3) represents the last assigned PSR. So, in more detail, if the ISPSRASSIGNED value is TRUE and PSR_SYC1 and PSR_SYC2 are both populated, the PSR_SYC2 is the value I want to pick up and display in the dashboard.

       

      Is there any way to build this statement ?

       

      Many thanks for your ideas

        • 1. Re: How to build a statement for specific scenarios?
          Joe Oppelt

          IF [ISPSRASSIGNED]                      // this assumes ISPSRASSIGNED is a Boolean field.  If it's string, then do [ISPSRASSIGNED] = 'TRUE'

          THEN

             IF NOT ISNULL([PSR_SYC3])   // if this is not null then it's the last one populated

             THEN  [PSR_SYC3]  ELSE

                IF NOT ISNULL([PSR_SYC2])   // If we dropped to here then [3] was null.  if this is not null then it's the last one populated

                THEN [PSR_SYC2]  ELSE

                [PSR_SYC1]                        //  If we dropped to here then [3] and [2] were null, and this assumes that [1] is populated

                END

             END

          END

           

          You may need to clean up some syntax, but that's the gist of one way to do this.

          1 of 1 people found this helpful
          • 2. Re: How to build a statement for specific scenarios?
            harris.tsr

            Thank you very much for your contribution!