11 Replies Latest reply on Nov 10, 2018 4:06 AM by george.gousios

    Filter through parameter

    george.gousios

      Hello,

       

      I have Cyl 1 and Cyl 2 fields.

       

      I want to apply a correction in each of them and use the corrected value.

       

      The correction should be able to take the appropriate field (if Cyl 1 then the Cyl 1, if Cyl 2 then the Cyl 2).

       

      I must find a way to define a filter in order to able to switch between Cyl 1 and Cyl 2 in order to do the correction.

        • 1. Re: Filter through parameter
          Jim Dehner

          Good Morning George

          See the attached approach

           

          I added a parameter

           

          then used a case statement to do the "Correction"

           

          Jim

          If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

          • 2. Re: Filter through parameter
            george.gousios

            Hello Jim,

             

            Thanks for the help.

             

            That is not what I want though.Maybe I wasn't too much specific, so:

             

            1) The Correction field that I use must stay there (it will be used many times and from many sheets)

             

            2) I must be able to plot date-cyl1 and by using a filter use the corrected  value for cyl 1 , if I want to plot date-cyl 2, it should use the corrected value for cyl 2

             

            3) I don't want to use a parameter control and select from there the appropriate Cyl1 or Cyl2.

             

            Thanks!

            • 3. Re: Filter through parameter
              Jim Dehner

              Hi George -

              Little confused - your post title

              Filter through parameter     

               

              says you want to use a parameter but now you don't want a parameter

              Is the issue that you want the corrected value to use cycle 1 and separately

               

              the formula below (revised)

               

              returns this

               

              or this

               

              Jim

              • 4. Re: Filter through parameter
                Paul Wachtler

                Hi George,

                 

                It sounds like you just want to have a parameter called "Correction" that let's you input the corrected value.  Make it a float and allow for any value.

                 

                Then you can create calculated fields called "Cyl1 Corrected":

                Cyl1 * [parameters.Correction]

                 

                and "Cyl2 Corrected"

                Cyl2* [parameters.Correction]

                 

                That way the Correction parameter is always there with whatever value you entered last.  And you can bring it onto any other sheets as well.  Make sure to use the "Cyl1 Corrected" and "Cyl2 Corrected" fields for your plots and whenever you update your parameter, the plots will update as well.

                 

                Best,

                Paul

                • 5. Re: Filter through parameter
                  george.gousios

                  Hi Jim and thanks for the help.

                   

                  The problem is that I don't want to use a parameter selector in order to select between cyl1 and cyl2.

                  (I couldn't open your last twbx, due to an error (from my side) , but I think you use again the parameters control in order to select the jd corrected).

                   

                  I want to have 2 sheets.

                   

                  One sheet with date - cyl1 and one with date - cyl2.

                   

                  But when I have cyl1, use cyl1 corrected.

                  And when I have cyl2, use cyl2 corrected.

                   

                  I think I have to somehow pass a filter in order to do so.

                   

                  I hope it is clear now, thanks!

                  • 6. Re: Filter through parameter
                    george.gousios

                    Hi Paul and thanks for the help.

                     

                    I can't understand your solution in contrast with my requirements.

                     

                    You say to have a Correction parameter but I have to explicity define the correction.

                     

                    Thanks

                    • 7. Re: Filter through parameter
                      Paul Wachtler

                      Hi George,

                       

                      Parameters allow you to input any values that you want at any time.  They're not like filters where the values are predefined.  So therefore you would only be able to explicitly define the correction with a parameter.

                       

                      Here's an article on their functionality:

                      Create Parameters - Tableau

                       

                      Best,

                      Paul

                      • 8. Re: Filter through parameter
                        george.gousios

                        But I want to do for example Cyl1 + 0.25*(1- Cyl1)

                         

                        How can I import to parameter that kind of equation?

                         

                        Am I missing something?

                        • 9. Re: Filter through parameter
                          Paul Wachtler

                          I guess it depends on which part of that is the correction.  Is it just the .25?  If that's the case then you can use a parameter to change that value in a calculated field like this:

                           

                          Cyl1 + [parameters.Correction] * (1 - Cyl1)

                           

                          Then whatever you type into the parameter will be used in that calculation.

                           

                          If you want to have that whole calculation be dynamic you can't really do that. 

                          • 10. Re: Filter through parameter
                            Jim Dehner

                            George

                            the simple answer it that you can't - parameters are set by the user manually - ant they are changed manually

                            so the question becomes how to do what you want without a parameter - you have 2 separate measures - 1 for cycle 1 the other for cycle 2 - one way to do what you want is to pivot the data ( Pivot Data from Columns to Rows - Tableau )  you will then have a column of pivot names (those will ce the cycle 1 and 2 ) and another column of values

                            You can then use the pivot name column as a filter and base your calculations on the  pivot name/values

                            Jim

                            • 11. Re: Filter through parameter
                              george.gousios

                              Ok, I  will accept this answer.

                               

                              I can't pivot the data though, I don't have access to sql.

                               

                              The obvious solution is just to use for every Cyl a seperate correction.I wanted to avoid that because I will have many of them.

                               

                              Thanks for all the help and clarification Jim.