function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Anurag SaxenaAnurag Saxena 

Assistance in SAQL

I need to write a SAQL to get the lowest margin of my shipment records:

Here is the formula:
Lowest margin = (Lowest unit price-Cost price of product which has lowest unit price)/Cost price of product which has lowest unit price .
Here is My SAQL-


q = load "Shipment_with_Receiver";
q = group q by all;
q = foreach q generate trunc((((min('Unit_Price__c')-min('Product__c.Cost__c'))*0.01)/min('Product__c.Cost__c')),2) as 'Lowest Margin Calcualtion';

Thanks