Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
sakshikaul
Creator II
Creator II

date functionality

Hi,

I have a query, I want to compare the sales for a current year with sales 10 days prior to current year

Here in the below image when user selects an event , corresponding date for that particular event and corresponding days for comparison 

for eg as shown in below image users select event as Diwali, date as 10/10/2018

no of days for comparison =9

so Date selected for comparing is calculated based on following 

Date selected by user(10/10/2018 )- no of days for comparison (9) so  'Date selected for comparison '=1/10/2018 

so now I have to compare between the given range last year date ie 1/10/2018  and current year date 10/10/2018,

so this is working fine only if I am selecting no of days for  comparison as 1,2,3,4,5,6,7,8,9 but if I am selecting  no of comparison days as 10 then its not working  because here date selected for comparison will be 30/09/2018 so this means here the month will be changed .

This is working fineThis is working fine

this is not working finethis is not working fine

 

27 Replies
pradosh_thakur
Master II
Master II

What is your expression?
Learning never stops.
sakshikaul
Creator II
Creator II
Author

=sum({< Sold_Date = {">=$(From)<=$(To)"} >} quantity_sold)
- sum({< Sold_Date = {">=$(From)<=$(To)"} >} quantity_returns)

pradosh_thakur
Master II
Master II

Are from and to variables? If yes how do the look like?

Learning never stops.
shiveshsingh
Master
Master

It depends on your Model, this month change should not affect. Need to check the Variable value and expression.

Do you get any values if you check values for these two dates separately? for 31/09/2018 & 10/10/2018?

sakshikaul
Creator II
Creator II
Author

From variable contains following value- =date(date(DaysOfComp),'D/M/YYYY')

To variable contains following value=date(lastdate,'D/M/YYYY')

sakshikaul
Creator II
Creator II
Author

Yes if I am selecting date 31/09/2018 the corresponding values are shown.but if I am using a variable in the expression its not showing any result.

Even if I input No of comparison days as 11 or 12(ie =>10) no result is shown in the charts.

pradosh_thakur
Master II
Master II

how is No of comparison days related to the calculation . I am sorry bit we have limited view of data so you have to describe a bit.

Learning never stops.
shiveshsingh
Master
Master

How come you are getting values for 31st September?

 

secondly, are you evaluating this expression?

=sum({< Sold_Date = {">='30/09/2018'<='10/10/2018'"} >} quantity_sold)
- sum({< Sold_Date = {">='30/09/2018'<='10/10/2018'"} >} quantity_returns)

sakshikaul
Creator II
Creator II
Author

Hi,

No. of comparison days means if user selects 9 as comparison days this means the user is interested in seeing  sales 9 days  prior to current date (that is selected by user under Date column)

therefore we can say if user selects date as 10/10/2018 and no of comparison days as 9, so this clearly means that user is interested in seeing the sales from 1/10/2018 till 10/10/2018

ie date             -          no of comparison days    =   last year date(after calculation )

10/10/2018       -                          9                             = 1/1/2018