Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
henrikalmen
Specialist
Specialist

Change pivot dimension totals label when current dimension is a sub-dimension of a parent

I have a pivot table in Qlik Sense with several expandable dimensions. Each dimension has the totals column calcualtion activated.

I want the total label to state one thing for a dimension (e.g. a formula that results in "totals january-december" based on months in current selections), but I want the totals label to be something different (e.g. simply "Total") if the dimension is an expanded dimension, i.e. not the first dimension in the chart.

I could probably achieve this with GetObjectDimension() if the dimension was a row expansion, but in my case I am expanding columns and I cant be sure how many row dimensions there are in the current layout of the pivot table (as I have asked about in a related but separate question).

Example when my "month" dimension is the first dimension:

  Totals (jan-feb) january february march april
value 600 200 150 200 50

 

If month is not the first dimension (in this case "quarter" is first), I want to change the totals label like this:

  Q1 Q1 Q1 Q1 Q2 Q2
  Total Q1 january february march Total Q2 april
  550 200 150 200 50 50

 

Is it possible?

Labels (1)
4 Replies
Chanty4u
MVP
MVP

Try this

if(GetCurrentFieldIndex() = 0, 'Totals (january-december)', 'Total')

 

Chintam
Contributor II
Contributor II

Hi Try using GetFieldSelections(),

in label as 'Totals ('&GetFieldSelections([month])&')' 

In pivot you may need to move the dimension top to enable the Totals you can apply the same for all the dimensions as is.

henrikalmen
Specialist
Specialist
Author

@Chanty4u GetCurrentFIeldIndex() doesn't exist. GetCurrentField() is a QlikView function that gets the current dimension of a cyclic group and that is not my issue (also, I'm on Qlik Sense).

henrikalmen
Specialist
Specialist
Author

@Chintam GetFieldSelections() retrieves selected values, but that does not relate to my question at all. My issue is that I want to determine if the dimension is the top column dimension or if it isn't, regardless of any selections.