Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Thathayoyo
Contributor III
Contributor III

Pivot Table: How to get the name of the dimension placed in first dimension

Hello,

I have a pivot table where i want to know the name of the first dimension ( Item Desc in the exemple below) so that i can store it in a variable. For exemple if the first dimension is Item Desc then my variable need to return Item Desc. If the user is moving Product Group as the first dimension then the variable need to return now Product Group.

Thanks.

 

Thathayoyo_0-1733924150263.png

 

Labels (6)
1 Solution

Accepted Solutions
NoahF
Contributor III
Contributor III

I think @Or  means something like:

=if( $(vToggle) = 'Item Desc', [Item Desc] , 
	if( $(vToggle) = 'Product Group', [Product Group], [Customer]))

or instead of using Strings in the toggle variable I would probably use numbers:

=if( $(vToggle) = 1, [Item Desc] , 
	if( $(vToggle) = 2, [Product Group], [Customer]))

 

 

View solution in original post

11 Replies
Or
MVP
MVP

As far as I know, you can't do that directly (perhaps through Automation in SaaS? Not sure). Otherwise you'd have to do it the other way around - create a calculated field that changes based on the selected variable.

NoahF
Contributor III
Contributor III

as @Or  mentioned, I don't think you can do that outside of the context of the pivot table.

However within the pivot table you can use the function getObjectField(0) to get the name of the first Dimension used.

 

Thathayoyo
Contributor III
Contributor III
Author

Thanks do you have an exemple I am not sure to understand what you mean about the calculated field.

NoahF
Contributor III
Contributor III

I think @Or  means something like:

=if( $(vToggle) = 'Item Desc', [Item Desc] , 
	if( $(vToggle) = 'Product Group', [Product Group], [Customer]))

or instead of using Strings in the toggle variable I would probably use numbers:

=if( $(vToggle) = 1, [Item Desc] , 
	if( $(vToggle) = 2, [Product Group], [Customer]))

 

 

Thathayoyo
Contributor III
Contributor III
Author

Thanks and what does $(vToggle) correspond to. I dont see to what i need to link it.

NoahF
Contributor III
Contributor III

First you need to create the variable vToggle in the script:

Let vToggle = 1;


Then you can use the variable input Object or normal buttons to switch the value of the variable.

NoahF_0-1733927544266.png

The user can then click on one of the Dimensions, the variable will change, and therefore your first Dimension in the pivot table will show accordingly.

NoahF_1-1733927639796.png

 

Thathayoyo
Contributor III
Contributor III
Author

Okay so in the Properties of the table in Show column if i link the display of the column with the number select in $(Toggle). So if i select the button Item Desc it will display as the first dimension and then if i select after also Product Group it will be second dimension.

The problem is i can only select on value with a button switch so i can't display more than one column in the pivot table like that? And also if the user select more than one things how to keep track what value was the first select in $(Toggle) because Qlik is ordering values?

 

NoahF
Contributor III
Contributor III

That's why you should rather use the variable input Object.

This will allow you to toggle between the different values, and only allows the user to apply one value to the variable.

NoahF_0-1733929253658.png

Also don't use the show hide functionality for the first Dimension of the pivot table. There you want to use the calculated Dimension as i mentioned above. Then you can have 2 more calculated Dimensions after, which always show the opposite dimensions of the first one. 

For example: If the user wants the Item Desc to be first he selects the button in the variable input. Then the first calculated dimension will show the Item Desc. The second calculated dimensions will show the product group for example and the third will show the customer. 

 

Thathayoyo
Contributor III
Contributor III
Author

Thanks i think i understand the idea behind , the only what is still blurry is where inside the pivot table my $(Toggle) is used in order it switch the select dimension as first dimension according to selection in the variable input.