Calculate the Percentage from the same column

#1

Table

Hi All,

I have started learning KNIME and currently stuck with percentage calculation in the same column

Now I would like to calculate the HRA percentage for each column separately.

Formula is: HRA / Salary which is 4000/10000 = 40%

Could you please help me how to do this calculation and achieve 40% for each column?

Best Regards

0 Likes

#2

use a transpose node, do your calculation and use a transpose node again

gr
Hans

1 Like

#3

I did that, however when I used Math Formula (Multicolumn) to calculate the percentage I don’t see any column names in it.

Is there any other node which will help me to calculate the percentage?

0 Likes

#4

Hi @tvsreekanth,

after your transpose node you have only string columns.
It seems you read your content from Excel-File. Setup your Excel-Reader with ‘Table contains column names in row number=1’ and ‘Table contains row IDs in column=1’.
If you then transpose your table, you will find your columns in Math Formula.

Hope this help
Andrew

2 Likes

#5

Unfortunately it doesn’t help me since I have used many other calculations before this and this is one of the cases which I need to calculate in the workflow.

0 Likes

#6

Hi and welcome to the KNIME forum,


percentage.knwf (54.9 KB)

Feel free to ask any further questions.

Best,
Armin

P.S. The right approach is the one suggested by @Andrew_Steel, but as you said:

this is an alternative to solve your issue for now. But keep in mind to read column headers and row IDs (if available) in the future.

2 Likes

#7

Thank you so much Armingrudd. This is exactly what I wanted :blush:

Thank you so much all for your help

2 Likes

closed #8

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

0 Likes