Salse Portion

Hey
I want to calculate "Salse Portion":
Capture
How do you do that?!

Hi @nurit.a
It sounds like you’re looking for Custom Expressions:
https://www.metabase.com/blog/custom-expressions/index.html

@flamber tnx
but i am looking for a SQL function for this problem

@nurit.a Okay, then go to stackoverflow.com and try to find SQL for the database type you’re using.

This is the way to the solution:
SELECT SUM(netIncome) AS 'net ’
,net/ ( SELECT sum(netIncome) from ALLOrders ) as “percent to total”
,category
from ALLOrders
group by category