         (indicator_id,region_id,campaign_id,value,is_calc)
 
         SELECT
-        part.indicator_id as master_indicator_id
-        ,d_part.region_id
-        ,d_part.campaign_id
-        ,d_part.value / NULLIF(d_whole.value,0) as value
-        ,CAST(1 as BOOLEAN) as is_calc
+		part.indicator_id as master_indicator_id
+		,d_part.region_id
+		,d_part.campaign_id
+		,d_part.value / NULLIF(d_whole.value,0) as value
+		,CAST(1 as BOOLEAN) as is_calc
         FROM(
           SELECT max(id) as max_dp_id FROM datapoint_with_computed
         ) x

        (indicator_id,region_id,campaign_id,value,is_calc)

        SELECT
    	 cic.indicator_id
    	,ad.region_id
    	,ad.campaign_id
    	,SUM(ad.value) as value
           ,'t'
        FROM agg_datapoint ad
        INNER JOIN calculated_indicator_component cic
            ON ad.indicator_id = cic.indicator_component_id

CREATE FUNCTION fn_calc_datapoint() 
RETURNS TABLE(dwc_id int)
    AS $$ 

	DROP INDEX IF EXISTS dwc_uq_ix;

	TRUNCATE TABLE datapoint_with_computed;

   	INSERT INTO datapoint_with_computed
    	(indicator_id,region_id,campaign_id,value,is_agg,is_calc)

    	SELECT
