Announcements
The way to achieve your own success is the willingness to help somebody else. Go for it!
cancel
Showing results for
Did you mean:
Creator

## set analysis when max(date, 2) not working when selecting a different date

Hello everyone,

I have an issue on a set analysis date selection, I want to select the penultimate date available. It only works without any filters applied, but it stops working when a different date is selected. The expression goes like:

=COUNT({< [DATE]={'\$(=MAX(DATE,2))'}>}operation_id)

PD: it works perfectly (with and without filters) when looking for actual date (max(date))

Thanks!

Labels (3)

• ### Set Analysis

1 Solution

Accepted Solutions
MVP

``Count({<[DATE] = {"\$(=Max({<DATE = {[<\$(=Max(DATE))]}>}DATE))"}>} operation_id)``
11 Replies
Creator III

Hi,

Because =MAX(DATE,2) returns the second highest date, the expression only works if you select at least 2 days from the filter.

Max(date,2) always picks second maximum date even filter/not filter. Could be this way?

=If(GetSelectedCount(DATE)>0, Count(operation_id), COUNT({< [DATE]={'\$(=MAX(DATE,2))'}>}operation_id))

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Creator
Author

Hey Anil, thanks for responding. Doesn't work because if shows the highest date. I need the second hightest date.

I know that when you select a date, for instance, 2019-11-10. And you calculate count({<[DATE]={"=\$(=max(DATE, 2))"}>}operation_id) it results on a null date.

So I need to show/unhide the second highest date available, based on that selection.

Thanks

Try this?

count({<[DATE]={"=\$(=max({1}DATE, 2))"}>}operation_id)

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
MVP

``Count({<[DATE] = {"\$(=Max({<DATE = {[<\$(=Max(DATE))]}>}DATE))"}>} operation_id)``
Creator
Author

it works! Thanks Sunny.

Creator
Author

I'm curious. What's the logic behind that set analysis?

MVP

The inner set analysis or the outer one?

Creator
Author

Both, but more interested on how the inner set analysis brings out the second highest date without calling the max(date, 2)

Tags
Community Browser