Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

ssims2017
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
ssims2017
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
Digvijay_Singh
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)

ssims2017
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

ssims2017
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')

OmarBenSalem
Esteemed Contributor

Re: Max Date as Dimension

=aggr(max(all Date),Date)

Community Browser