Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
thanhphongle
Creator II
Creator II

giving out a certain number of values

Hello Community,

I created a textbox which returns me the max price of my products

this is my database

ProductPrice
A1000
B500
C100
D1000
E1000
F600
G1000
H1000
I1000

this is my expression:

='Max Price ' & '\n' &

Concat(DISTINCT {<Product = {"=Aggr(max(Price), Product) = Max(TOTAL Aggr(max(Price), Product))"}>} Product, ', ') & ' ...' & '\n '

& money(Max(TOTAL Aggr(Max([Price]),Product )))

QV returns me:

ProductPrice
A1000
D1000
E1000
G1000
H1000
I1000

This is definetly correct.

But what I want is, that QV should return me max 3 values. Something like:

A = 1000

D = 1000

E = 1000 etc. ...

is this possible?

15 Replies
Joaquin_Lazaro
Partner - Specialist II
Partner - Specialist II

OK.

Why A,D,E and not G,H,I ?

Do you want a table ?

sunny_talwar

You can try this:

='Max Price ' & '\n' &

FirstSortedValue(Product, -Aggr(Max(Price), Product) + Ord(Left(Product, 1))) & ' ,' &

FirstSortedValue(Product, -Aggr(Max(Price), Product) + Ord(Left(Product, 1)), 2) & ' ,' &

FirstSortedValue(Product, -Aggr(Max(Price), Product) + Ord(Left(Product, 1)), 3) & ' ,'

& ' ...' & '\n '

& money(Max(TOTAL Aggr(Max([Price]),Product )))

thanhphongle
Creator II
Creator II
Author

I dont actually care if its A, D, E or G, H ,I. I wrote it in the alphabatic order. I dont want a table, it just should return the max price and 3 corrospondending products

thanhphongle
Creator II
Creator II
Author

its . working ! thank you !

Joaquin_Lazaro
Partner - Specialist II
Partner - Specialist II

Great thanhphongle

Hope I helped you

sfatoux72
Partner - Specialist
Partner - Specialist

You could try this expression too:

I removed all your aggr that are not necessary

='Max Price ' & '\n' &

Left(Concat(DISTINCT {<Price = {$(=max(Price))}>} Product, ', '),Index(Concat(DISTINCT {<Price = {$(=max(Price))}>} Product, ', '), ', ', 3))

& ' ...' & '\n '

& money(Max([Price]))