# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

New Contributor II

## Max Date as Dimension

I want to calculate the max date to use as a dimension.  The other discussion I have seen around this only address this calculation as a measure (as far as I can tell)

DateDate(Max(Date),'YYYY-MM-DD')
2018-03-012018-03-03
2018-03-022018-03-03
2018-03-032018-03-03

If I use this cacluation as a measure in a table, I get the expected result.  But if I calculate it as a dimension, it gives me an invalid dimension error.  I need to calculate it as a dimension to use on an axis of a bar chart.

1 Solution

Accepted Solutions
New Contributor II

## Re: Max Date as Dimension

Your ideas helped and I got it to work by adding TOTAL to Max and wrapping it with AGGR.

Date(Aggr(Max(TOTAL Date),Date),'YYYY-MM-DD')

4 Replies
Honored Contributor III

## Re: Max Date as Dimension

May be try this -

if(Date=Max(Date),Date)

or

Aggr(if(Date=Max(Date),Date),Date)

or

Aggr(Only({<Date={\$(=Max(Date)}>}Date)

New Contributor II

## Re: Max Date as Dimension

Thank you for the ideas...  I was hopefull that adding the if statement would work, but unfortunately not.

if(Date=Max(Date),Date) returned invalid dimension error

Aggr(if(Date=Max(Date),Date),Date) returned the Date and not max date

Aggr(Only({<Date={\$(=Max(Date)}>}Date) returned invalid dimension error

New Contributor II

## Re: Max Date as Dimension

Your ideas helped and I got it to work by adding TOTAL to Max and wrapping it with AGGR.

Date(Aggr(Max(TOTAL Date),Date),'YYYY-MM-DD')

Esteemed Contributor

## Re: Max Date as Dimension

=aggr(max(all Date),Date)