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: 
userid128223
Creator
Creator

calculate margin error

I am trying to calculate margin within straight table expression.

My formula works until this point.

Sum (([order tabl.qtyship] * [order table.Unit Price]) - ([order table.qtyship] * [order table.Unit Cost]))

however when i start dividing the whole thing with gross sales, in order to get margin. it stops working.

Sum (([order tabl.qtyship] * [order table.Unit Price]) - ([order table.qtyship] * [order table.Unit Cost]))    /      Sum ([order tabl.qtyship] * [order table.Unit Price])

I have tried putting brackets on entire expression without any results.

what am i doing wrong. Please explain.

3 Replies
Not applicable

I can't see anything wrong with the expression so this might simply be a number formatting issue, go to the presentation tab and for that expression make sure that "Expression Default" is un-checked, then set your formatting for a number and make sure that "Display as percentage" is switched on at the bottom.

whiteline
Master II
Master II

Hi.

What is the dimension of your straight table ?

How many different values of  [order tabl.qtyship] and [order table.Unit Price] do correspond to one dimension value ?

Not applicable

Hi,

below expr may help u.

Sum( (([order tabl.qtyship] * [order table.Unit Price]) - ([order table.qtyship] * [order table.Unit Cost])) / ([order tabl.qtyship] * [order table.Unit Price]) )