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

14 Replies
sunny_talwar
MVP
MVP

May be you need this?

=if(sDate >= Max(Total sDate, 2), Number, Null())

Anonymous
Not applicable
Author

Mhh, no this is not what i mean.

In column 3, i want to show the difference from numbers of the latest date - number of the previous month. The correct result would be 10 in this case.

2017-06-29_13h57_12.jpg

sunny_talwar
MVP
MVP

Try this

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

Capture.PNG

Anonymous
Not applicable
Author

Thank´s it works.

Why is there an empty row? Can i remove this row?

2017-07-03_11h12_41.jpg

sunny_talwar
MVP
MVP

Uncheck 'Include Null values' under the data tab for your dimension

Capture.PNG