Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
hopkinsc
Partner - Specialist III
Partner - Specialist III

Help with Gross Profit %

Hi, I am trying to work out Gross Profit.

I think the fields i need to use are salesvalue-cost/salesvalue... am i right?

i have to calculate an expression to get my total sales value and total cost value. My expressions are:


sum(aggr(sum({$<LineType -= {V}>} total <EAN> SalesValue),[Cust Name],[Product Code],[Prod Desc],EAN,Size,PriceOverride))

and

sum(aggr(sum({$<LineType -= {V}>} total <EAN> ItemCost),[Cust Name],[Product Code],[Prod Desc],EAN,Size,PriceOverride))

Can anyone tell me what i would need to write to get the GP please?

3 Replies
pover
Partner - Master
Partner - Master

The following expression doesn't work?

sum({$<LineType -= {V}>} total <[Cust Name],[Product Code],[Prod Desc],EAN,Size,PriceOverride> ItemCost)

Regards.

hopkinsc
Partner - Specialist III
Partner - Specialist III
Author

Hi, thanks for your reply again, No that expression doesn't work....

Can anyone help?

johnw
Champion III
Champion III

If you know the right expressions for sales and for cost, and you know how to calculate gross profit from sales and cost, where is the confusion? The only thing I'd point out is that (A-B)/A = 1-B/A. So gross profit margin is also 1-cost/sales, which will save you having to calculate the sales twice. So assuming you have the right expressions for sales and for cost:

1-sum(aggr(sum({$<LineType -= {V}>} total <EAN> ItemCost ),[Cust Name],[Product Code],[Prod Desc],EAN,Size,PriceOverride))
/sum(aggr(sum({$<LineType -= {V}>} total <EAN> SalesValue),[Cust Name],[Product Code],[Prod Desc],EAN,Size,PriceOverride))