Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
jamesmf1982
Contributor III
Contributor III

Calculating the percentage of a row against the column value

Hi,

I have a pivot table that has two columns at the moment. Column A has the names of companies and column B shows how many hours they have worked: e.g.

AB
Bruce Ltd200
Dave Corp600
Peterson LLC200

The values in B are calculated via a variable, v_company_hours,

What I am looking to do is have a third column which will show the percentage each company works compared to the total of the column. e.g.

Header 1Header 2Header 3
Bruce Ltd20020%
Dave Corp60060%
Peterson LLC20020%

I know this is probably quite easy and somehow uses aggr but it has escaped me. Any help would be greatly appreciated.

1 Solution

Accepted Solutions
sunny_talwar

If this is in a straight table you can select the relative option on the expressions tab. Else, if you want to use an expression... you can use this

Assuming you expression is this

Sum(B).... try this

Sum(B)/Sum(TOTAL B)

View solution in original post

2 Replies
sunny_talwar

If this is in a straight table you can select the relative option on the expressions tab. Else, if you want to use an expression... you can use this

Assuming you expression is this

Sum(B).... try this

Sum(B)/Sum(TOTAL B)

jamesmf1982
Contributor III
Contributor III
Author

It seems that the relative option is my new friend! Thanks for this.