# how to calculate percentage in BIP rtf temaplate

#### mamta negi

##### Member
 Status % Total No. of Population % Male Population % Female Population XXX 50 30 66.66 20 33.33 10 XXXX 50 30 33.33 10 66.66 20 Total 100 60 100 30 100 30

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
modify the query to include a formula/calculated %

#### mamta negi

##### Member
modify the query to include a formula/calculated %
How can I do that , my query has group by ?

#### 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?

#### Larry_Jones

##### Legendary Poster
Are you asking how to get the Grand Total incluiding all groups?

#### mamta negi

##### Member
Are you asking how to get the Grand Total incluiding all groups?
Yes

Replies
0
Views
122
Replies
4
Views
1K
Replies
1
Views
487
Replies
1
Views
276
Replies
2
Views
2K