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: 
help4qv123
Creator II
Creator II

Set analysis max value

HI,

i have 3 columns..

By default i need a bar chart ,if u  select a key there is some max version for that key..i need the value of that version for all keys.

i have attached a sample for u..plz refer to that !

22 Replies
jpenuliar
Partner - Specialist III
Partner - Specialist III

almost

help4qv123
Creator II
Creator II
Author

no bro..the expression which u have sent is for max value...i need the count of oder count(oder) for each key with its max version,,,for eg: for key 20130101 max version is 2 and count of oder is 3...i need dis for all keys... !

help4qv123
Creator II
Creator II
Author

bro any output on my post

jpenuliar
Partner - Specialist III
Partner - Specialist III

you're better off manipulating the source table.

I derived the max version for each year and drop rows not related to max year:

data:
load * Inline
[
key, version, value, oder
20130102, 4, 7, oredr4
20110101, 3, 3, order1
20120201, 3, 76, order3
20130102, 3, 1, oredr4
20110101, 2, 11, order1
20120201, 2, 65, oder2
20130101, 2, 5, oder3
20130102, 2, 2, oredr4
20110101, 1, 12, order1
20120201, 1, 34, order1
20130101, 1, 6, oder3
20130102, 1, 4, order3
]
;

tab:
Join
Load key,
max(version) as MaxVersion
Resident data 
Group by key;

data1:
NoConcatenate
load
key,
version,
value,
oder,
MaxVersion
Resident data
Where version = MaxVersion;

drop Table data;

jpenuliar
Partner - Specialist III
Partner - Specialist III

resulting table :

jpenuliar
Partner - Specialist III
Partner - Specialist III

I suppose this app is a KPI thing?

ToniKautto
Employee
Employee

You can not resolve that with a set expression, since you are trying to alter the set row by row.

In your example I think =max(aggr(only(value), key, value)) gives the result you have specified

help4qv123
Creator II
Creator II
Author

it gives me the same values for the max version

i need the count(oder) with dimension as key...and for each key  there is max version...select max version for 1 key..then see there count of orders

help4qv123
Creator II
Creator II
Author

Thank you...lets c it could be done in front end

jpenuliar
Partner - Specialist III
Partner - Specialist III

add Flag to rows:

data1:
NoConcatenate
load
key,
version,
value,
oder,
MaxVersion,
If(version = MaxVersion,1,0) as MaxVersionValues
Resident data
;

so now you dont have to drop the non-related rows. table looks below: