Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Shriram_Sridhar
Partner - Contributor III
Partner - Contributor III

Set Analysis Date range doesn't work when we select a date?

Hi all,

I have used the below expression to calculate the amount starting from financial year to this date. But, When I try to change the date in the filters, the below expression doesn't work.

For example;

If I select date as 01/05/2017 in the filter, The report should list the values starting from 01/04/2017 to 01/05/2017 but instead it calculates all the values from 01/04/2017 to today.

I have used the below expression in my report;

=Sum({<Dim_Date={'>=$(=YearStart(Max(Dim_Date),0,4)) <=$(=Max(Dim_Date)))'}>}Amount)

What so strange here is when I put the start date in one text box and end date expression in one text box and then I select the date in filters, The dates are changing in the text boxes.

Please help me to fix this issue.

5 Replies
Anil_Babu_Samineni

You must declare the Variable name like

=Sum({<Dim_Date={'>=$(=YearStart(Max(Dim_Date),0,4)) <=$(DateRangeVariableName)'}>}Amount)


OR


=Sum({<Dim_Date={'>=$(=YearStart(Max(Dim_Date),0,4)) <=$(=Max(Dim_Date)))'}>}Amount)

May be one extra parenthesis written


Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Shriram_Sridhar
Partner - Contributor III
Partner - Contributor III
Author

Hi Anil,

Thanks for the reply.Again I'm having the same problem. Is there any other simpler way to solve this. The Date inside the expression should change as I change the date in the filters, Also the year function too should work.

Anil_Babu_Samineni

Can you please attach work file to test

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable

Try below one

Sum({$<

Dim_Date={">=$(=MonthStart(AddMonths(Max(Dim_Date),-1)))<$(=MonthEnd(Max(Dim_Date)))"}>}Amount)

sunny_talwar

How about if you use Date() function

=Sum({<Dim_Date = {"$(='>=' & Date(YearStart(Max(Dim_Date), 0, 4), 'DD/MM/YYYY') & '<=' & Date(Max(Dim_Date), 'DD/MM/YYYY'))"}>} Amount)