Percentage Value to Column

Hi-

Is there any way I can get percentage value from example below.

Name Class Score
Ariel Math 85
Ariel Physics 60
Ariel Chemistry 75
Ariel Biology 80
Ricky Physics 95
Ricky Sports 55
Ricky English 80
Jacob France 85
Jacob Chemistry 95

Assuming each student will have different class and the percentage is vs name column. Basically % score to Name is for each student (example, Ariel %Math is 85/(total score in all of her class) to get results as below and so on for each student name.

Name Class Score %Score to Name
Ariel Math 85 28%
Ariel Physics 60 20%
Ariel Chemistry 75 25%
Ariel Biology 80 27%
Ricky Physics 95 41%
Ricky Sports 55 24%
Ricky English 80 35%
Jacob France 85 47%
Jacob Chemistry 95 53%

Thanks in Advance!

Hi @andersenyunan,

please have a look at the attached worfklow.

I could create the percentage value only as string ins the “Percentage to name column”, it is fine for presentation and visualisation.

For further calculation in your workflow you can use the decimal values in column: “%Score to Name”.

Roland

Percentage.knar.knwf (39.1 KB)

3 Likes

hi @rolandnemeth & @andersenyunan

roland’s solution looks just fine. You should change the groupby aggregation column from “Class” to “Name”. Besides, I would always change the format of a field in the output file. Within KNIME you can use Right-click “Available renders” (table view on the column header) → “Percentage”.

My workflow looks like this (identical to roland’s approach)…
grafik

br
Tommy

4 Likes

Thanks @rolandnemeth & @tommy for the help

It works perfectly!

1 Like

As far as i can remember the math formula node was also able to calculate the column sum so you might be able to calculate the result with only one node (can’t access KNIME to test right now)
br

Yes, the Math Formula Node can do several column operations, but not group-wise. So there’s no way around the GroupBy-Joiner combo.
Guten Rutsch, T

1 Like

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