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 add a custom total row in a straight table?

Let's say I have the following table:

Product       Price          Qty

food           $5.00            4

bed            $10.00          6

bread         $20.00          3

Total          $35.00          13

That's easy, I know how to do that, but the thing is that I want another Straight table with the following values

     Company                   Price          Qty

     Head & Shoulders       $35.00         13   

                     Total          $35.00         13

This is a simple example, with the example that I have, I can't just calculate it again, because of some conditions that one of the table has, so what I did was CLONE THE STRAIGHT TABLE THEN SET THE "SHOW ROWS" TO 0, however the problem is that I don't know how to add the "Head & Shoulder" row.

I repeat,  I can't do the same exact calculation Meaning I can't do a Sum(price) and sum(quantity), because this works in my example, but not with what I'm doing.

1 - Is there a way that I can call the same total value that I have in the other Straight table?

2- Is there a way that I can copy the total row, and then add a custome column to it?

3 Replies
rotero
Creator
Creator

AFAIK if you are using table object , no way you can add calculated field or column.

Not applicable
Author

if you add the "Head & Shoulder" row.

then in script--

load *,

'Head & Shoulder' as Company

from table;

in pivot/straight---

dimension tab--> in calculated dimension write-- 'Head & Shoulder'

and then in label write its name as Company

Not applicable
Author

try this

A:

LOAD * INLINE [

    Product, Price, Qty

    food, $5.00, 4

    bed, $10.00, 6

    bread, $20.00, 3

];

load

'Head & Shoulder' as Company,

sum(mid(Price,2)) as sumprice,

sum(Qty) as sumQty  Resident A;

see attachement