9 Replies Latest reply: Dec 6, 2012 1:26 AM by Gaurav Malhotra RSS

    Add/Remove Dimension based on selection

    Qliker Max

      Hi guys,


      Is it possible to add or remove dimensions from a table?

      Please see my simple example, what I wanted to achieve is the user can select which dimension to show, with the table always expanded.


      Thanks for any help.



        • Add/Remove Dimension based on selection
          ALEXIS TAN



          Yes it is possible^^


          I would attach my solution with your given file


          but I can't seem to find where the "Attach File" button here >.>


          so could you tell me how?




            • Add/Remove Dimension based on selection
              Qliker Max

              Sorry, can't find it either... it was at the bottom when i created my post but with reply it's no longer available.


              Guys, please help...


              can you send it on my email thanks. hajile_28@yahoo.com



                • Re: Add/Remove Dimension based on selection
                  ALEXIS TAN

                  Our Emails are blocked in our office >.> sorry


                  I'll try to explain how I did it...


                  I'm using Qlikview 11 fyi. and I did it using buttons


                  1.) I Created 4 variables (Settings > Variable Overview)

                       vEMP, vPOS,vSALARY,and vTYPE


                       I set all values to 0.


                  2.) I Created 2 Buttons called "ADD Dimension" and "REMOVE Dimension"


                  For "ADD dimension" button:

                       inside botton properties under Actions tab

                       click Add > External > Set Variable then OK

                       under Variable, type: vEMP

                       under Value, type or copypaste: =if($Field = 'EMP',1,vEMP)

                       repeat this step for vPOS,vSALARY,and vTYPE


                  For "REMOVE dimension" button:

                       repeat the above steps again

                       but this time the Values are: =if($Field = 'EMP',0,vEMP), =if($Field = 'vPOS',0,vPOS) and so on


                  3.) I Created a listbox


                       with "Dimensions" as Title

                       and Field as Expression: =aggr(only({<$Field = {*}-{'DEDUCTION'}>} $Field),$Field)


                  4.) Create a Pivot Table


                       under Dimensions tab:

                       Add: EMP, POS, SALARY, TYPE on your "Used Dimensions"

                       Click "Enable Conditional" for all four dimensions

                       then type or copypaste: vEMP =1 (for EMP), vPOS =1 (for POS) and so on


                       under Expressions tab:

                       Add sum(DEDUCTION) then I set DEDUCTION as its label.


                  Try to select 1 dimension from your list box then click ADD Dimension.


                  Best Regards,


              • Re: Add/Remove Dimension based on selection
                David Gibbs

                Do they want to be able to see just one of the dimensions at a time or do they want to have the ability to see any combination of them?


                If they just want one at a time you could set up a cyclic group with all the fields in and then use that in place of the individual dimensions. Your users can then either cycle through the fields, or they can drop the list down from the cycle button and go straight to the field they want.


                Not as elegant as the optional visibility we now have in QV11, but it is simple to do and works well enough.


                Other than that you will either need to create multiple copies of your table that you can show or hide depending on which combination of dimensions you want, or you are in for some rather heavy macro coding using the AddDimension and RemoveDimension methods of the straight and/or pivot table objects.


                Hope some of that might help.




                • Re: Add/Remove Dimension based on selection
                  Qliker Max

                  Hi Guys,


                  Solutions provided was indeed helpful but since I'm not using QV11 yet and the second solution does not offer flexibility on dimensions order.

                  I came up with the solution that I got from a friend.


                  What I did was, I created several cyclic groups that has the same dimensions inside but different orders. Then my users will just have to select the right combination that she like and viola!


                  Thanks guys for help, and I hope you can also use this technique if applicable in your next requirement.



                  • Re: Add/Remove Dimension based on selection
                    Gaurav Malhotra



                    I need to show some default fields in a straight table, & then the feature of adding fields in that table. Is it possible, if it is then can you help me. I used the similar logic implemented in "What's New in QlikView 11" example document.