# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

## Extra row required - how to add

Hi,

I've taken a look around the forums and can't find an answer to this.

I have a simple table:

Status     Understanding     Team     Credibility

Won               9                    8               9

Lost               5                    2               4

I want to add a new calculated row that shows the difference between won/lost values so values would be 4, 6 and 5. Is this possible and how do I do it?

thanks,

Chris

Tags (1)
1 Solution

Accepted Solutions
MVP

## Re: Extra row required - how to add

Check this out:

Script:

Table:

LOAD * Inline [

Status, Understanding, Team, Credibility

Won, 9, 8, 9

Lost, 5, 2, 4

];

Dim:

LOAD * Inline [

Dim

1

2

];

Table

Dimension: Pick(Dim, Status, 'Difference')

Expressions:

1) Pick(Dim, Sum(Understanding), Sum(TOTAL {<Status = {'Won'}>} Understanding) - Sum(TOTAL {<Status = {'Lost'}>} Understanding))

2) Pick(Dim, Sum(Team), Sum(TOTAL {<Status = {'Won'}>} Team) - Sum(TOTAL {<Status = {'Lost'}>} Team))

3) Pick(Dim, Sum(Credibility), Sum(TOTAL {<Status = {'Won'}>} Credibility) - Sum(TOTAL {<Status = {'Lost'}>} Credibility))

17 Replies
MVP

## Re: Extra row required - how to add

Add an Inline table which will not be connected to your other datasource (Island Table)

Dim:

LOAD * Inline [

Dim

1

2

];

and then use this in your calculated dimension:

Pick(Dim, Status, 'Difference')

Expression

Pick(Dim, Count(Status), Count(TOTAL {<Status = {'Won'}>} Status) - Count(TOTAL {<Status = {'Lost'}>} Status))

Not applicable

## Re: Extra row required - how to add

Hi Sunny,

Thanks for the reply.

does this mean I need to add a manual table which contain all my dimension values? So Dim 1 and 2 in your response relate to values that appear in understanding (9 and 5) and team fit (8 and 2) or to the 2 status' (won and Lost)?

Thanks,

Chris

MVP

## Re: Extra row required - how to add

It related to neither of them. It just relates to an additional row you need. if you need 10 additional rows then it would be 1 to 10 (For instance if you want to calculate sum, difference, multiplication, division.... and so on). But in your case, since you just need difference, it will always be 1 & 2 for Dim.

Honored Contributor II

## Re: Extra row required - how to add

Hi Chris,

You can even do this:

data:

load * inline [

Status,Understanding,Team,Credibility

Won,9,8,9

Lost,5,2,4

];

NoConcatenate

temp:

if(Status = 'Lost',Understanding*(-1),Understanding) as Ust,

if(Status = 'Lost',Team*(-1),Team) as Tm,

if(Status = 'Lost',Credibility*(-1),Credibility) as Cred

Resident data;

Concatenate(data)

aggregated:

load 'Summary' as Status,

sum(Ust) as Understanding,

sum(Tm) as Team,

sum(Cred) as Credibility

resident temp;

drop table temp;

As you will not be doing any calculation in the front end, your performance will be better.

Thanks,

Sangram.

Not applicable

## Re: Extra row required - how to add

I can get it to add 'difference ' as a column but not calculate it correctly as a single row which I'm after. I'm clearly doing something wrong and am very new to Qlik. Qlik only allows me to add a column so do I add a measure instead?

Thanks again.

MVP

## Re: Extra row required - how to add

Would you be able to share your qvf (I think that is what it is called I guess )

Not applicable

## Re: Extra row required - how to add

I believe the QVF will contain the rest of my data which is a bit more sensitive so not something I can share.

Valued Contributor

## Re: Extra row required - how to add

Please find the attached document

=if(Test='Difference','Difference',Status) Understanding Team Credibility
14 10 13
Won989
Lost524
Difference465

Cheers,

Naresh

Not applicable

## Re: Extra row required - how to add

Perhaps an easier solution, but not exactly what you asked for:-

Create a new table underneath your existing one, with the difference as the only calculation in it.