create table Ram
(
Block int,
responsibility varchar(500),
Heads varchar(50),
Dept varchar(500),
Actuals float
)
insert into Ram values('1','Sales','Sales','01.Sales (net of Sales Tax)','1087.60')
My sample table Ram Shown like these
BLOCK RESPONSE HEADS DEPT ACTUALS
1 Sales Sales 01.Sales (net of Sales Tax) 1087.6
1 Finance Sales 02.LESS:-EXCISE DUTY 22.8
1 Sales Sales 03.Net Sales 1064.8
2 HR HR 04.Personnel Cost 170.6
3 Materials COGS 05.Material Cost 376.7
Now i wanna calculate percentage for these table that formula is
from block 2 onwards divide the value from block 1 dept=03.netsales values
(i.e)
percentage = dept(04) actuals * 100 / dept(03)
Expecting Output
BLOCK RESPONSE HEADS DEPT ACTUALS Pecentage
1 Sales Sales 01.Sales (net of Sales Tax) 1087.6 0
1 Finance Sales 02.LESS:-EXCISE DUTY 22.8 0
1 Sales Sales 03.Net Sales 1064.8 100 =>(1064.8*100/1064.8)
2 HR HR 04.Personnel Cost 170.6 16.17 =>(170.6 *100/1064.8)
3 Materials COGS 05.Material Cost 376.7 35.37 =>(376.7*100/1064.8)
How to make a code for my expecting output?