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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

if statement to select highest value

Hi,

i am working on a piece of code in which I want to select the highest value. Max() should by all means work however I pulling the data in from another table in which it holds several of the data types I am looking for.

Eg. I am looking for MD, and there are 3 MD characteristics in the spreadsheet so using sum will give me 301. 301 is the highest value so I want to show that but using max() gives me 180, one of the vales for MD. Using max(sum()) is obviously garbage.

Can anyone help me on this, is there a way of using an if statement to recognise that 301 is the highest value?

My code to get the 301 is sum{<SPREADSHEET.Data={"MD"}>} BILL_SQ)

.Thanks in advance,
mckay9999



Labels (1)
3 Replies
johnw
Champion III
Champion III

I'm betting that max(aggr(sum())) is involved, but it's very unclear to me from your explanation what you specifically need. Possibly this:

max(aggr(sum(BILL_SQ),SPREADSHEET.Data))

spsrk_84
Creator III
Creator III

Hi,

Could you explain the issue with some sample data values.......

Regards,

Ajay

Not applicable
Author

Sorry for not explaning enough. Right

-Im pulling data from a table (SQI). to get this data im using a spreadsheet- so the line spreadsheet.data="MD" is looking for things on the SQI by filtering through the spreadsheet. Pulling the data, which is categorised as MD.

-On qlikview, I have a table that tells you all the months and what the MD is for each month. i'm trying to create a column in which I have the max MD, so users can select this instead of filtering through the report looking for the highest.

-On the sqi table there are several MD characteristics, thus why I'm using sum(). When I use max, it selects the highest MD, but not the highest sum of MD.

a sample of data-

Month/MD
Jan- 160
Feb- 120
Mar- 0
Apr- 301
May- 250
Jun- 279
Jul- 134
Aug- 18

Hope this is enough, thanks for your replies