Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to show the totals for a dimension?

The expressions autommatically show the totals in a staright table.

Why the dimensions don't do the same, and how can I achieve it?

1 Solution

Accepted Solutions
Peter_Cammaert
Partner - Champion III
Partner - Champion III

Change your script into:

Pivot:

Load [Full Text Reason Code], Count([Full Text Reason Code]) AS NoOfOccurrences from Raw.qvd (qvd)

group by [Full Text Reason Code];

Now create a straight table with Dimension [Full Text Reason Code] and expression =Sum(NoOfOccurrences). and  Total Mode set to Expression Total.

Every Dimension value has only one occurrence (because of the GROUP BY) but that doesn't matter. And the Total mode will perform its duty.

Is this what you need, or do you want to sum the [Full Text Reason Code] as well?

Best,

Peter

View solution in original post

7 Replies
bbi_mba_76
Partner - Specialist
Partner - Specialist

HI,

I don't understand: you want to sum the dimension fields?

m_bardun
Partner - Contributor II
Partner - Contributor II

When and why would you want to show the total of the dimension? Example?

Not applicable
Author

Yes

Not applicable
Author

Because if I display it as an expression I cannot script it, I would have to go and use the drag and drop interface that is tedious.

Pivot:

Load [Full Text Reason Code], Count([Full Text Reason Code]) from Raw.qvd (qvd)

group by [Full Text Reason Code];

So on my straight table I just want to add all dimensions and have have a row for the totals autommatically.

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Assuming the dimension is numeric, and is additive in nature, create another expression in the table

     =Sum(DimensionName)

where DimensionName is the name of the dimension you want to total. (Use sum() or other aggregation so the total is correct)

Then hide the actual dimension (on the Presentation tab)

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Peter_Cammaert
Partner - Champion III
Partner - Champion III

Change your script into:

Pivot:

Load [Full Text Reason Code], Count([Full Text Reason Code]) AS NoOfOccurrences from Raw.qvd (qvd)

group by [Full Text Reason Code];

Now create a straight table with Dimension [Full Text Reason Code] and expression =Sum(NoOfOccurrences). and  Total Mode set to Expression Total.

Every Dimension value has only one occurrence (because of the GROUP BY) but that doesn't matter. And the Total mode will perform its duty.

Is this what you need, or do you want to sum the [Full Text Reason Code] as well?

Best,

Peter

emkabi646
Partner - Contributor II
Partner - Contributor II

You can claculate the sum of Dimension in the column label and insert a line feed - like this

='Dimension '&chr(10)&sum(Dimension)