ACTUAL TOD

diver (real) = (sum($area , group_by:="lu_type_en")/sum($area , group_by:="naam")) * (log10(sum($area , group_by:="lu_type_en") /  log10( count_distinct(  "lu_type_en" ))))

total_div(real) = sum( "diver", group_by:="naam" )

mix (real) = (sum($area, group_by= "naam", "lu_type_en"  =  'residential')) /((sum($area, group_by= "naam", "lu_type_en" = 'residential' )+(sum($area, group_by= "naam", "lu_type_en" is not 'residential' ))))

total_mix (real) = sum( "mix", group_by:="naam" )

div_norm (real) = ("div_total" - minimum("div_total")) / (maximum("div_total") - minimum("div_total"))
 
mix_norm (real) = ("mix_total" - minimum("mix_total")) / (maximum("mix_total") - minimum("mix_total"))

popd_norm (real) = ("POP_DNSTY_" - minimum("POP_DNSTY_")) / (maximum("POP_DNSTY_") - minimum("POP_DNSTY_"))

leng_norm (real) = ("lenght_sum" - minimum("lenght_sum")) / (maximum("lenght_sum") - minimum("lenght_sum"))

int_norm (real) = ("count_sum" - minimum("count_sum")) / (maximum("count_sum") - minimum("count_sum"))

tod_index (real) = "div_norm"*0.2+"mix_norm"*0.2+"popd_norm"*0.2+"leng_norm"*0.2+"int_norm"*0.2


POTENTIAL TOD

diver (real) = ((sum($area, group_by:="lu_type_en")/sum($area , group_by:="naam")) * (log10(sum($area , group_by:="lu_type_en")/sum($area , group_by:="id")))) / log10( count_distinct(  "lu_type_en" ))

total_div(real) = sum( "diver", group_by:="id" )

mix (real) = (sum($area, group_by= "id", "lu_type_en"  =  'residential')) /((sum($area, group_by= "id", "lu_type_en" = 'residential' )+(sum($area, group_by= "id", "lu_type_en" is not 'residential' ))))

total_mix (real) = sum( "mix", group_by:="id" )

div_norm (real) = ("div_total" - minimum("div_total")) / (maximum("div_total") - minimum("div_total"))

mix_norm (real) = ("mix_total" - minimum("mix_total")) / (maximum("mix_total") - minimum("mix_total"))

popd_norm (real) = ("POP_DNSTY_" - minimum("POP_DNSTY_")) / (maximum("POP_DNSTY_") - minimum("POP_DNSTY_"))

leng_norm (real) = ("lenght_sum" - minimum("lenght_sum")) / (maximum("lenght_sum") - minimum("lenght_sum"))

int_norm (real) = ("count_sum" - minimum("count_sum")) / (maximum("count_sum") - minimum("count_sum"))

tod_index (real) = "div_norm"*0.2+"mix_norm"*0.2+"popd_norm"*0.2+"leng_norm"*0.2+"int_norm"*0.2