Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Get First document with min and max price by product

Hello collegues!

I am begginer in QV practice, I will apreciate if anybody give me an advise for resolving this case:

I have a pivot table with diferent products with diferent prices in various documents or invoices. Ok, then I want to get the fist invoice or document with the minimum price and other result on top column get the fist invoice or document with the maximum price by product.

Example: According my e.g., I must to get:

Product      MinPrice      MaxPrice  MinDocument  MaxDocument

Product A          2               4                 77               33         

Product B          2               5                 44               22

Product C          7               9                 77               55

I applied the next funtion and other relatives at FirstValue for instance:

FirstSortedValue(DOCUMENT,Aggr(Count(PRODUCT), DOCUMENT))

But i have not good results   Could you help me please? I attach the QVW.

I appreciate your advises!

Thanks everybody for advance!

1 Solution

Accepted Solutions
sunny_talwar

Capture.PNG

Exp1: =Min(PRICE)

Exp2: =Max(PRICE)

Exp3: =FirstSortedValue(DISTINCT DOCUMENT, PRICE)

Exp4: =FirstSortedValue(DISTINCT DOCUMENT, -PRICE)

View solution in original post

3 Replies
sunny_talwar

Capture.PNG

Exp1: =Min(PRICE)

Exp2: =Max(PRICE)

Exp3: =FirstSortedValue(DISTINCT DOCUMENT, PRICE)

Exp4: =FirstSortedValue(DISTINCT DOCUMENT, -PRICE)

Not applicable
Author

Thks a lot dear Sunny T.

I appreciate your help! I am gointo to implement the solution in real case right now!

sunny_talwar

Real scenarios are usually much more difficult than samples. So in case you have any trouble you can always come back to the community and someone will be more than happy to help you out.

Cheers,

Sunny