Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
tamilarasu
Champion
Champion

Minimum Function Doubt

Hi All,

I have used a min function in my chart in order to get minimum sales value for one customer. In adjacent column, I just want to show the order id.  Say for example, the data looks like below

Customer  Sales Price     Order ID

A                  10                1111

B                   9                 2222

C                   11               1000  

I want to get a minimum sales price  (9 in this case) in a column (Expression) and the order ID (2222) for that sales price. Also, I tried to use first sorted value for the sales value but the same not working for Order ID. It just picking the 1000 for the sales price value 9. Kindly guide.

Kind Note: This is just a sample data.

6 Replies
sunny_talwar

Can you share the raw data from which you got the above result?

MK_QSL
MVP
MVP

=FirstSortedValue([Sales Price],[Sales Price])

=FirstSortedValue([Order ID],[Sales Price])

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try using the FirstSortedValue function: FirstSortedValue( [Order ID], [Sales Price])


talk is cheap, supply exceeds demand
tamilarasu
Champion
Champion
Author

Hello All,

Sorry for the late reply. I Just tried the above solutions and came across one scenario. I used the below expression but it seems taking incorrect value fr two columns.


If suppose the values like below,

SOPR.KBPR.Cust_NamePR.Cust_Numb
100012    AA1
100012    BB2
100012    CC3
200012    DD

4


I am getting correct value in the pivot chart. But total field seems wrong. I just want to show best of best value in the total (as summary).

  

MaterialBest ZPSOPR.Cust_NamePR.Cust_Numb
A1121000DD

4

Expression I used:


Expression for SO.


=if(SecondaryDimensionality()<>0,

      FirstSortedValue({<PR.KR={'12'}>} Distinct BEST_ZP , PR.KB),

        If([Best_ZP]<>'',

      

        FirstSortedValue(Distinct {<PR.KR={'912'},PR.KB={">0,01"}>} BEST_ZP , PR.KB)

  )      

  )

Similarly I just changed the dimensions for SO, cust name and number.

Guess, Something wrong in the sorting the values.

See below excel for better understanding.

sunindia: I am not allowed to post original data.

sunny_talwar

Can you try this:

=if(SecondaryDimensionality()<>0,

      FirstSortedValue({<PR.KR={'12'}>} Distinct PR.Cust_Name , PR.Cust_Numb),

        If([Best_ZP]<>'',

     

        FirstSortedValue(Distinct {<PR.KR={'912'},PR.KB={">0,01"}>} PR.Cust_Name , PR.Cust_Numb)

  )     

  )

tamilarasu
Champion
Champion
Author

Customer name and customer number itself wrong for the above SO. I think the problem is SO consists of two or more same prices with different Customer name and customer number.

If I change sort weight for an expression, it affects other columns (Values changing) in my original data.

I just tried the same scenario in below qvw file but not working.


Untitled.png

animated-thank-you-smiley-emoticon.gif.