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: 
sakshikaul
Creator II
Creator II

Using Variable From and To in calendar object

Hi

I have a query I want to write an expression in which I have  variable named FROM in which i have passed a value as

FROM =date(Date#(lastDate)-$(compday),'DD/MM/YYYY')

and another variable as

TO =date(Date#(lastDate),'DD/MM/YYYY')

Following variable is used in a calender Object as shown below :-

PAINT2.png

so here From variable is taking value as 01/10/2017 andTo variable is taking value as 10/10/2017.

Now when I am writing an expression using the following variable FROM and TO it is not giving me desired result

Please help stalwar1

7 Replies
lironbaram
Partner - Master III
Partner - Master III

hi

what expression do you use in the table

can you give some more information

sakshikaul
Creator II
Creator II
Author

Hi

I am using following expression in pivot table object

=sum({StateA< lastDate = {">=$(From)<=$(To)"} >} [inv value])

lironbaram
Partner - Master III
Partner - Master III

HI     

you need to make sure that your variables are in the same date format as the Date field

in your case try to format them to 'D/M/YYYY'

sunny_talwar

Would you be able to share a sample qvw to check this out?

sakshikaul
Creator II
Creator II
Author

I am not able to attach qvw

Please help

Anil_Babu_Samineni

May be

=sum({StateA< lastDate = {">=$(=From)<=$(=To)"} >} [inv value])

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
sakshikaul
Creator II
Creator II
Author

Hey

I think this calendar object is not a good idea to use here rather I should simply assign a value to a variable and  Please help me how to call that variable in an expression ?

PAINT2.png

here in the above picture when the user will enter comparison no. of days as 8 then the date will be calculated as

10 oct 2018 -8=2/10/2018

so now 2/10 /2018 will become start dtae taken in text box and end_date will be always the last_date in this case

and last_date is actually a field name

Now how to use these variables in table expression?

start date text box contains following

=date(date(DaysOfComp),'D/M/YYYY')

end_date

=date(lastDate,'D/M/YYYY')