If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.
Hi Community,
I searched for this a lot now and I also found a few threads that all show me the same method (like this one):
Find out max numerical value in a QlikView script | Qlik Community
When using the described method, I get a value but it is not the highest in my dataset.
For more explanation:
I have a field called ExpNr which contains only numerical values (at the moment from 1 to 9) so I expect the value 9 for my script:
TempMaxExpNr:
Load Max(ExpNr) as MaxExpNr resident Experiment_Info;
Let vExpMax = FieldValue('MaxExpNr', 1);
But instead of 9, I get the value 3.
I hope someone can help me with my problem
Regards
Chris
I don't think it would make a difference, but can you try this:
LET vExpMax = Peek('MaxExpNr');
Also if possible, would you be able to share a sample?
I don't think it would make a difference, but can you try this:
LET vExpMax = Peek('MaxExpNr');
Also if possible, would you be able to share a sample?
Actually, it makes a difference. I tried Peek() the second you mentioned it, and it works ...
Sometimes I don't understand this program at all.
Thank you Sunny!
Regards
Chris
For this sample, I get the same values
Table:
LOAD * Inline [
Field
1
2
3
4
5
6
7
8
9
];
Max:
LOAD Max(Field) as MaxField
Resident Table;
LET vMax1 = FieldValue('MaxField', 1);
LET vMax2 = Peek('MaxField');
TRACE FieldValue $(vMax1);
TRACE Peek $(vMax2);
Do you happen to have MaxExpNr created elsewhere in the script as well?
Hi Christoph,
As sunny mentioned, Peek() function should help solve your issue after the max() aggregation.
Thanks,
Sangram.
But Sangram why would FieldValue() won't work? Is it a bug in QlikSense?
Hi Sunny,
no, I do not use it somewhere else.
I can not provide sample data due to security issues.
But your example is probably exactly the same data setup (the difference would be that the values in ExpNr happen to appear multiple times. The data looks somewhat like this
ExpNr | cnt | Timestamp |
---|---|---|
1 | 12 | 01.01.2016 00:00:00 |
1 | 11 | 01.01.2016 01:00:00 |
2 | 3 | 01.01.2016 00:00:00 |
2 | 1235 | 01.01.2016 01:00:00 |
The 'Note' in help talks about exactly the same.
Though, my testing is not yet conclusive.