diff --git a/v1_apache-hop dash mapping/region/total_registered.child_minor(reg).hpl b/v1_apache-hop dash mapping/region/total_registered.child_minor(reg).hpl index 13ee4bf..04838e3 100644 --- a/v1_apache-hop dash mapping/region/total_registered.child_minor(reg).hpl +++ b/v1_apache-hop dash mapping/region/total_registered.child_minor(reg).hpl @@ -264,10 +264,7 @@ COALESCE(SUM("2_child"), 0) two_children, COALESCE(SUM("3_child"), 0) three_children, COALESCE(SUM("4_more_child"), 0) four_or_more_children, - CASE - WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' - THEN 0 - ELSE COALESCE( + COALESCE( CASE WHEN SUM(total_count) > 0 THEN ROUND((SUM(no_child) / SUM(total_count) * 100), 2) @@ -275,10 +272,7 @@ END, 0 ) no_children_percent, - CASE - WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' - THEN 0 - ELSE COALESCE( + COALESCE( CASE WHEN SUM(total_count) > 0 THEN ROUND((SUM("1_child") / SUM(total_count) * 100), 2) @@ -286,10 +280,7 @@ END, 0 ) one_child_percent, - CASE - WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' - THEN 0 - ELSE COALESCE( + COALESCE( CASE WHEN SUM(total_count) > 0 THEN ROUND((SUM("2_child") / SUM(total_count) * 100), 2) @@ -297,10 +288,7 @@ END, 0 ) two_children_percent, - CASE - WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' - THEN 0 - ELSE COALESCE( + COALESCE( CASE WHEN SUM(total_count) > 0 THEN ROUND((SUM("3_child") / SUM(total_count) * 100), 2) @@ -308,10 +296,7 @@ END, 0 ) three_children_percent, - CASE - WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' - THEN 0 - ELSE COALESCE( + COALESCE( CASE WHEN SUM(total_count) > 0 THEN ROUND((SUM("4_more_child") / SUM(total_count) * 100), 2) @@ -321,7 +306,7 @@ ) four_or_more_children_percent, '${REG_ID}' AS recruitment_id, "all_M_W" AS gender, - convicts, + convicts, 'Organization' AS schema FROM total_registered.child_minor WHERE recruitment_id = ANY ('${VK_ARRAY}')