40 Replies Latest reply: Jul 21, 2015 9:17 AM by Bill Markham Branched to a new discussion. RSS

    Qlik Sense Variables

    Kalyan Navuluri

      Hi All,

       

      I'm very much new to Sense, Here are my doubts

       

      How to create and use variable like this

       

      We have a variable in qlikview like (Created in Variable Overview)

       

      Let vTodayto60Days = OrdDate = {">=$(vPast60)<=$(vToday)"}, OrdMonth = , OrdYear = , OrdQTR =

       

      and then we use this variable in other calculations like

       

      Sum($(vTodayto30Days) Total_Ord)

       

      Now i want same setup in qlik sense how can we do this

       

      I tried many thing to get this work, but i failed .

       

      Can any one suggest how to do this?

        • Re: Qlik Sense Variables
          Sunny Talwar

          Would you be able to share a sample?

            • Re: Qlik Sense Variables
              Bill Markham

              You will need to create the variable in the QlikSense load script.

               

              The variable definition in your post look incomplete though.  Is this a typo or what you are actually trying to use ?

               

                   Let vTodayto60Days = OrdDate = {">=$(vPast60)<=$(vToday)"}, OrdMonth = , OrdYear = , OrdQTR =

                • Re: Qlik Sense Variables
                  Kalyan Navuluri

                  Hi Bill,

                   

                  My mistake there was a typo in my final expression.

                   

                  Actually what I'm trying to do is just passing expression text to variable , so that later i can evaluate that text as expression in qlikview.

                   

                  Here what i want is if i evaluate vTodayto60Days like $(vTodayto60Days) it must show the expression text  like this

                  OrdDate = {">=$(vPast60)<=$(vToday)"}, OrdMonth = , OrdYear = , OrdQTR =

                  without evaluating.

                   

                  As i mention earlier them my final expression


                  Sum({<$(vTodayto30Days)>} Total_Ord)

                   

                  will be like this

                   

                  Sum({<OrdDate = {">=$(vPast60)<=$(vToday)"}, OrdMonth = , OrdYear = , OrdQTR = >}Total_Ord)

                   

                  in simple words if i create variable in script like

                   

                  Let or Set vVariable = 'Some Text'

                   

                  how can i get vVariable value 'Some Text' as it is in UI?

                   

                  One more thing i didn't select any answer as correct, but somehow Bill answer select as correct one any idea?

                    • Re: Qlik Sense Variables
                      Michael Tarallo

                      Hi KN, I marked it, (from time to time, when responding in the community I will do so) I will un-mark and allow you to do so. I felt that was the most direct answer, and then provided you with an example that you can mark as HELPFUL if you wish.

                       

                      Let us know how you do.

                       

                      Regards,

                       

                      Mike T

                      Qlik

                  • Re: Qlik Sense Variables
                    Kalyan Navuluri

                    Hi stalwar1

                     

                    Thanks for looking into it, i need some time to prepare the example (Out of office)

                  • Re: Qlik Sense Variables
                    Michael Tarallo

                    Hi K N,

                     

                    Bill is correct, at the moment all variables are set in the load script in the data load editor. I created a simple example for you. Also see screen shots:

                     

                    Variable in editor:

                     

                    LET v2015Sales = 'Sum({1<Year={2015}>}Sales)';


                    Variable used in expressions: =$(v2015Sales)

                     

                     

                     

                    Please mark the appropriate replies as CORRECT / HELPFUL so our team and other members know that your question(s) has been answered to your satisfaction.

                     

                    Regards,

                    Mike Tarallo

                    Qlik

                      • Re: Qlik Sense Variables
                        Kalyan Navuluri

                        Hi Michael,

                         

                        For simpler expressions i am able to do like you said, but what i'm trying is bit different.

                         

                        Lets take your example

                         

                        I declare a variable like this using SET or LET

                         

                        let v2015Sales = 'Year={2015}';

                         

                        So in  your final expression i would like to use this variable like this way

                         

                        =Sum({1<$(v2015Sales)>}Sales) i just replaced Year={2015}' with $(v2015Sales)

                         

                        I am able to do this Qlikview but not in sense.

                         

                        I hope you got some understanding on what i am trying to do.

                      • Re: Qlik Sense Variables
                        Alexander Karlsson

                        Open up the data load editor and press Ctrl + 0 + 0 (zeroes) and it will insert the load script at the cursor position.