Hi @Ajit_Londhe ,
I use the following SQL script to calculate BMI using the measurement table.
First I had created the SQL script in PostgreSQL and then changed the tables and schemas and cohort number to the relevant parameters.
“select
cast (4060705 as bigint)1000 AS covariate_id,
‘BMI (25-29)’ AS covariate_name,
4060705 AS concept_id,
count(distinct subject_id) AS sum_value,
sum(BMI)/count() AS average_value
from
(select subject_id, AVG(weight.value_as_number/(height.value_as_number/100height.value_as_number/100)) as BMI
from @cohort_table cohort
join @cdm_database_schema.measurement height on cohort.subject_id = height.person_id and height.measurement_concept_id = 3036277
join @cdm_database_schema.measurement weight on cohort.subject_id = weight.person_id and weight.measurement_concept_id = 3025315
where cohort_definition_id = @cohort_id
and weight.value_as_number/(height.value_as_number/100height.value_as_number/100) >=25
and weight.value_as_number/(height.value_as_number/100*height.value_as_number/100) <30)
GROUP BY 1,2,3”