I have a table with fields like total_expense,material, business_name, etc. Now I want sum(total_expense) where the first grouping is to be done on the basis of material and then on business_name. How can I do that?
Not sure what you are asking, Do you want to create a chart/table? Then use material and business_name as dimensions and sum(total expense) as the expression/measure.
I don't want to create a chart . I want to do that in the backend (in script).
Do you mean that you need to group by on the combination of material and business_name? If so just group by with material and business_name in script,
sum(total_expense) as expense_total
group by material, business_name;
Is this what you are looking for?
sum(total_expense) as sum_total_expense
Group By material, business_name;
Retrieving data ...