I have fields : date, ordered_quantity, amount, etc.
I need to create a line chart with a parameter to switch between metrics. This parameter would have values : Order Quantity, Amount, Avg Unit Price
Avg Unit Price = sum( {ordered_quantity})/ sum({amount})

how do I make this work?

my current calculated field is
ifelse ( ${param} = ‘Order Quantity’, {ordered_quantity},
${param} = ‘Amount’, {amount},
${param} = ‘Avg Unit Price’, {Avg Unit Price},
NULL)

This gives and aggregate non aggregate error. how to implement this

Create other calculations for Ordered_quantity as sum,avg or what ever you want. same for amount as well.
then you try to create the below calculation.
sum({amount}) - name it as Sum_Amount
sum({ordered_quantity}) - name it as Sum_ordered_quantity

Hey Raju, thanks for the response, it did not work out. since my avg unit price is sum( {ordered_quantity})/ sum({amount}), this is calculated in qs. Instead the below worked