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: 
Anonymous
Not applicable

Problem with Max[,rank]

Hi,

in this thread i asked Expression - Filter for dimension

if i use a dimension in a chart and want to filter the values of the dimension, how can i do it?

The answer was for example

=if(Name='*Samsung*',Name,Null())


Now i want to use Max() in an expression like this:

=if(date = Max(Total date,2),Sales,Null())

The editor shows "ok", but the chart table shows only grey fields.

I test this expression

Max(total date,2)

and this one

=if(date = Max(Total date),Sales,Null())

Both shows the correct data.

What´s wrong in this expression?

=if(date = Max(Total date,2),Sales,Null())

regards,

sam

1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

Try this

=Aggr(FirstSortedValue(Number, -sDate) - FirstSortedValue(Number, -sDate, 2), Product)

Capture.PNG

View solution in original post

14 Replies
sunny_talwar
MVP
MVP

What is the dimension here? and I am guessing that you are using this as an expression?

Anonymous
Not applicable
Author

I use a chart table, create a new dimension and in the fieldname i write this expression:

=if(date = Max(Total date,2),Sales,Null())

Clever_Anjos
Support
Support

You need an aggregation, you have to choose by which field

Maybe this

Aggr(if(date = Max(Total date),date,Null()),date)

sunny_talwar
MVP
MVP

Do you have more than one dimension?

Anonymous
Not applicable
Author

yes 8 dimensions

sunny_talwar
MVP
MVP

And are you only looking to get the 2nd highest date across all these 8 dimensions?

Anonymous
Not applicable
Author

No, in other dimensions i´m looking for the 1st highest date.

sunny_talwar
MVP
MVP

Not sure I am understanding the requirement... would you be able to share some sample data or a sample app?

Anonymous
Not applicable
Author

Yes...