Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
From the previous thread
Re: Returning seller name where selling price is the lowest.
I believe i now need this done within the script as i want to count the number of results where a customer has the lowest price.
The following however, gives me a minimum Price for each customer for [Common Name] but i only want the lowest Price for the [Common Name] and whichever [Customer] that would be. Am i on the right track here or does it need to be done a different way?
CustomerMIN:
Load
[Customer],
[Common Name],
Min([Unit Price]) as MINPRICE
Resident Data
where "Exclude" = 'No' and [International] = 'Yes'
Group by [Customer],[Common Name];
I thought it was ^^
This sort of works, however if the lowest Unit Price occurs more than once in the data it does not show the Seller with Lowest Price, the value is instead blank.
(Like below)
Product | Price | Seller | Volume | Min Price | Seller with Lowest Price |
Product 1 | 1.1 | Seller A | 1100 | 1.1 | |
Product 1 | 1.1 | Seller A | 1150 | 1.1 | |
Product 1 | 1.2 | Seller A | 1200 | 1.1 | |
Product 1 | 1.2 | Seller B | 1200 | 1.1 | |
Product 1 | 1.25 | Seller B | 1250 | 1.1 | |
Product 1 | 1.3 | Seller B | 1300 | 1.1 | |
Product 1 | 1.3 | Seller C | 1300 | 1.1 | |
Product 1 | 1.35 | Seller C | 1350 | 1.1 | |
Product 1 | 1.4 | Seller C | 1400 | 1.1 | |
Product 2 | 1.1 | Seller A | 1100 | 1.0 | Seller C |
Product 2 | 1.15 | Seller A | 1150 | 1.0 | Seller C |
Product 2 | 1.2 | Seller B | 1200 | 1.0 | Seller C |
Product 2 | 1.25 | Seller B | 1250 | 1.0 | Seller C |
Product 2 | 1.0 | Seller C | 1000 | 1.0 | Seller C |
Product 2 | 1.35 | Seller C | 1350 | 1.0 | Seller C |
Change this
FirstSortedValue(Seller, Price) as [Seller with Lowest Price]
to
FirstSortedValue(DISTINCT Seller, Price) as [Seller with Lowest Price]
But if two sellers provide the lowest price? What would you want to see then?