Sum of products of 2 different measure

i am trying to do a row level operation by multiplying 2 measures and then doing the sum like
“$main.sum($amount * $weight).fallback(0)”

However i am getting javascript diabled error. Can someone help if this is doable? I know doing it at ingestion time but there are cases where someone would want to define a custom measure

Hi Harshit,
What version of Druid are you using? You may need to set druid.javascript.enabled=true in the common.runtime.properties file.

-Ben