How does Shopify calculate gross margin percentage?

No matter how I calculate, I can’t get the gross margin in % to be correct. Can someone tell me how Shopify calculates this? I would calculate it as (Netsales -COGS)/Netsales but Shopify seems to calculate it differently. In the pictures below I would say Gross profit / Net sales should show me Gross margin, but it dosen’t