Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Customer & Partners, DEC. 9, 11 AM ET: Qlik Product & Strategy Roadmap Session: Data Analytics REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
RishabhTFC
Contributor III
Contributor III

Sm of two columns

Hi,

I have a problem i.e I want to create a column that has the sum of two columns of data that is loaded in the application.

The sample data is given here below:

1.JPG

This data is loaded in my Qlk Application. I want to create an another column and to present it in qlik pivot table that sums two other column means

(First year =  1st Sem+2nd sem, Second Year = 3rd Sem + 4th Sem)

5 Replies
kfoudhaily
Creator III
Creator III

so you always have 8 semesters to sum?

QlikView Qlik Sense consultant
raman_rastogi
Partner
Partner

Hi

If you have 1st Sem ,2nd Sem  .. as your expressions use

First Year=Column(1) + Column(2)

or

First Year=[1st Sem]+[2nd sem]

If you have 1st Sem ,2ndSem  ..as your Dimensions use

First Year =Sum([1stSem])+Sum([2ndSem])

Regards

Raman Rastogi

quriouss
Creator III
Creator III

I would probably add a RANGESUM* in there in case there is any possibility of a Null() or some text creeping in to the data.

First Year= Rangesum(Column(1) , Column(2))


or, more generally,


First Year =Rangesum (Sum([1stSem]) , Sum([2ndSem]))


*Remember:

10 + 5 = 15

10 + 'Example' = Null()

10 + Null() = Null()

Rangesum(10, 5) = 15

Rangesum (10 , 'Example') = 10

Rangesum (10, Null() ) = 10

RishabhTFC
Contributor III
Contributor III
Author

no it varies sometimes they are only 4 sem, sometimes 6 but mostly they are 8.

quriouss
Creator III
Creator III

I just re-read your question and noticed you want to do it in a Pivot Table.

I'm not sure the (Column(1) + Column(2)) approach will work in a Pivot Table, so it would be better to explicitly define which fields you want to sum.

(An even better approach would be to perform the sums in the load script itself.)