14 Replies Latest reply: Jul 4, 2017 7:24 PM by Sunny Talwar

# Problem with Max[,rank]

Hi,

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

=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

• ###### Re: Problem with Max[,rank]

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

• ###### Re: Problem with Max[,rank]

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())

• ###### Re: Problem with Max[,rank]

Do you have more than one dimension?

• ###### Re: Problem with Max[,rank]

yes 8 dimensions

• ###### Re: Problem with Max[,rank]

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

• ###### Re: Problem with Max[,rank]

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

• ###### Re: Problem with Max[,rank]

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

• ###### Re: Problem with Max[,rank]

Yes...

• ###### Re: Problem with Max[,rank]

May be you need this?

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

• ###### Re: Problem with Max[,rank]

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.

• ###### Re: Problem with Max[,rank]

Try this

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

• ###### Re: Problem with Max[,rank]

Thank´s it works.

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

• ###### Re: Problem with Max[,rank]

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

• ###### Re: Problem with Max[,rank]

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

Maybe this

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