Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

QlikView Pivot Table Expand/Collapse

hi, i am new at QV and is my first post here.

i need to know if is possible to automatize collapsing and expanding of column in pivot table (the same to right click on the top of table and click on "expand all" or "collapse all".)

if i select level 3 of 7 the level under that should be collapse (i should see the button)  and if i click on one of that should working as normal pivot table.

i need to have all level (i mean that i can't hide column as the value of a variable)

thanks in advance

3 Replies
Valued Contributor II

Re: QlikView Pivot Table Expand/Collapse


Try this Macro:

  1. Sub ShowHideExpression() 
  2.   SET chartObj = ActiveDocument.GetSheetObject("CH01"
  3.   SET chartProp= chartObj.GetProperties 
  5.   SET expr = chartProp.Expressions.Item(1).Item(0).Data.ExpressionData 
  6.   expr.Enable = False // Hides First expression 
  8.   SET expr = chartProp.Expressions.Item(2).Item(0).Data.ExpressionData 
  9.   expr.Enable = True // Displays Second expression 
  10. End Sub 

Hope it helps!!

Not applicable

Re: QlikView Pivot Table Expand/Collapse

i found this code but doesn't work.. (i am new and i have problem to adapt)
anyhow i understand that the code is for show or hide Expression... i need something to collapse or espande Dimension of pivot table.

if you can write the reference of the instruction to understand i thank you so much, i like to learn something new.


Contributor II

Re: QlikView Pivot Table Expand/Collapse


If you have button / text box for "3-7 Level", you can set action to run Macro with Macro Name - "ExpandAll".

Try below macro -

Sub ExpandAll


End Sub

Function CollapseExpandPivot (objectID)

Set chart = ActiveDocument.GetSheetObject(objectID)

        set ch=chart.GetProperties

        If ch.TableProperties.PivotAlwaysFullyExpanded =false then


                chart.SetProperties ch



                chart.SetProperties ch

        End If

End Function

Hoe this will resolve your issue.



Prashant P Baste

Community Browser