haria_kishore 0 Light Poster

Hi friends

Can someone help me in this pls.I have 2 tables in my DW

One is a table which have all data regarding Income and Expenditure details. The structure (columns) of the table is

ctgry_id,ctgry_nm,sbctgry1_nm,sbctgry2_nm,amount.,cmpny_id and tm_id

So the records in this table would look like

10001 Wages and salaries Bonus 1000 1001 10102
10002 Wages and Salaries Salaries 2000 1001 10102
10003 Repairs Cables 1000 1002 10103

and so on

Similarly the other table contains all the data regarding the assets and liabilities of the companies

The structure of the second table is

ctgry_id,ctgry_nm,sbctgry1_nm,opng_blnc,,addtn,ddctn,clsng_blnc,cmpny_id and tm_id

The records for this table would look like

1001 Gross Fixed Assets Land & Buildings 4.09 5 0 4.14 1001 10102
1002 Gross Fixed Assets Plant & Machinery 100 6 4 102 1002 10103
1003 Current Assets MAterial Stock 10 0 0 10 1001 0102

and so on

Now my problem is i need to generate a report where I calucate the total wages (i.e sum of ctgry_nm=Wages and Salaries) for a particular company and year and divide it by the total of Gross fixed assets (sum of Ctgry_nm=Gross Fixed Assets)

so my data should have somehing like

Gross fixed assets sum(gross_fxd_asst) sum(wages and salaries) calculation=sum(wages and salareis)/sum(gross fixed asst) cmpny nm year

Hope u got my problem. I tried this by creating a view by i m getting wrong results for one of the columns