Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
sgarim41
Contributor III
Contributor III

Ignore selections in date dimension to select Max value and last but one

Hi All,

I have a peculiar scenario where i have a date as a dimension as follows,

Date_DIM

05-10-2019

07-23-20019

08-19-2019

07-06-2019

 

I currently use Max(Date_DIM) and Max(Date_DIM,2) to get the top and top-1 values. The trouble now is when i do max  when selected, i get only one value which is fine, but i also need the value before that as well. For example if value 08-19-2019 is selected i need the previous value to be 07-23-2019.

Any help is appreciated.

Labels (1)
3 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Try this expression for the date previous to the selected date:

Max({<Date_DIM = {"<$(=Max(Date_DIM))"}>} Date_DIM)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
sgarim41
Contributor III
Contributor III
Author

This did not work. I also tried converting the max to date format also.

Do you have a sample for this which works?

Brett_Bleess
Former Employee
Former Employee

Santosh, have a look at the following Design Blog post, hopefully that may give you some additional ideas to try:

https://community.qlik.com/t5/Qlik-Design-Blog/A-Primer-on-Set-Analysis/ba-p/1468344

There are some other posts in the Design Blog area as well, if you want to search there yourself, use the following link:

https://community.qlik.com/t5/Qlik-Design-Blog/bg-p/qlik-design-blog

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.