Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
ssims2017
Contributor II
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
Contributor II
Contributor II
Author

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

View solution in original post

4 Replies
Digvijay_Singh

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
Contributor II
Contributor II
Author

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
Contributor II
Contributor II
Author

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

=aggr(max(all Date),Date)