how to calculate percentage in BIP rtf temaplate

mamta negi

Member
Status%Total No. of Population %Male Population%Female Population
XXX503066.662033.3310
XXXX503033.331066.6620
Total100601003010030

the query for the dataset is very huge and includes group by.
So how can i calculate percentage in the report itself.

TIA
 

Larry_Jones

Legendary Poster
I assume this is a SQL Query. SQL allows calculations using aggregate fields.
Example:
SELECT SDDOCO, SUM(SDAEXP/100) "SO_Total_Price", SUM(SDECST/100) "SO_Total_Cost",
SUM(SDAEXP/100)-SUM(SDECST/100) "Gross_Margin" ,
ROUND((SUM(SDAEXP/100)-SUM(SDECST/100))/SUM(SDECST/100)*100,2) "Gross_Margin%"
FROM PRODDTA.F4211
WHERE SDDCTO = 'SO' AND SDECST <> 0 AND SDNXTR = '529'
GROUP BY SDDOCO;
 

mamta negi

Member
I assume this is a SQL Query. SQL allows calculations using aggregate fields.
Example:
SELECT SDDOCO, SUM(SDAEXP/100) "SO_Total_Price", SUM(SDECST/100) "SO_Total_Cost",
SUM(SDAEXP/100)-SUM(SDECST/100) "Gross_Margin" ,
ROUND((SUM(SDAEXP/100)-SUM(SDECST/100))/SUM(SDECST/100)*100,2) "Gross_Margin%"
FROM PRODDTA.F4211
WHERE SDDCTO = 'SO' AND SDECST <> 0 AND SDNXTR = '529'
GROUP BY SDDOCO;
I am already using group by to get the total , how can I get the sum of total in the same query?
 
Top