Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Saurabh07
Contributor III
Contributor III

To get data for max date when no date is selected in the filter

I am trying to get sum of values in my table for the latest available date when no date is selected in filter.

I am using below expression, but somehow its not working;

sum({<date = {$(=max(date))}>}Value)

 

Can anyone please help me out with this?

2 Solutions

Accepted Solutions
Taoufiq_Zarra

@Saurabh07 

=sum({$<Date={"$(=Date(Max(Date),'DD/MM/YYYY'))"}>} Value)

 

output:

Capture.PNG

when i selected a Date:

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

Saurabh07
Contributor III
Contributor III
Author

@Taoufiq_Zarra Thanks for the expression. Even I worked and developed the mentioned expression;

sum({<date={"=date=Max(total date)"}>}Value)

Does this look correct  to you, it is working as per my requirement!

View solution in original post

10 Replies
Taoufiq_Zarra

@Saurabh07  check the date format or format it directly In set for example if your date format is DD.MM.YYYY

=sum({$<date={"$(=Date(Max(date),'DD.MM.YYYY'))"}>} Value)
Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Saurabh07
Contributor III
Contributor III
Author

Hello @Taoufiq_Zarra ,

Thank you for the reply, the date format seems to be fine. The error I am getting is 'Error in set modifier as hoc element: ',' or ')' expected.

The expression is getting evaluated in the expression editior, at the bottom preview shows:

Sum({<date = {30.06.2020}>} Value), which is exactly what I need here. But this error!!!!!

Taoufiq_Zarra

@Saurabh07  the SET DateFormat='DD.MM.YYYY'  ?

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Saurabh07
Contributor III
Contributor III
Author

@Taoufiq_Zarra  Why would Dateformat matter in this case. I just want to pick the latest date available and display the sum for value for it. Correct me if I am misunderstanding something here?

Taoufiq_Zarra

@Saurabh07 can you share a sample data ?

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Saurabh07
Contributor III
Contributor III
Author

@Taoufiq_Zarra  Attached is the sample dataset. Hope this helps.

I have a filter to select the date at the top. So whenever any date is selected exclusively the sum of value should be displayed for that particular date. But when nothing is selected in Date filter, the sum of values should be displayed for latest (i.e. Max) date. 

Taoufiq_Zarra

@Saurabh07 

=sum({$<Date={"$(=Date(Max(Date),'DD/MM/YYYY'))"}>} Value)

 

output:

Capture.PNG

when i selected a Date:

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Saurabh07
Contributor III
Contributor III
Author

@Taoufiq_Zarra Thanks for the expression. Even I worked and developed the mentioned expression;

sum({<date={"=date=Max(total date)"}>}Value)

Does this look correct  to you, it is working as per my requirement!

Taoufiq_Zarra

@Saurabh07  yes its correct !

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉