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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
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

did you select anything on last date? If you select i don't see why the expression should not work as expected.

Learning never stops.
sakshikaul
Creator II
Creator II
Author

yes I selected lastdate and then wrote this expression in the text box

 =$(Date(max(lastDate)- compday)

paint.png

pradosh_thakur
Master II
Master II

Did you try the expression i asked you to write initially

=sum({< Sold_Date = {"<=$(=max(Sold_date)) >=$(adddays(max(Sold_date),-compday))"}>} quantity_sold)

 

 alter the entire expression accordingly

Learning never stops.
sakshikaul
Creator II
Creator II
Author

Hi,

The following expression is working fine 

=Date(max(lastDate)- compday)

sakshikaul
Creator II
Creator II
Author

Hi 

I dont want maximum date, Rather I want whichever date user will select from given list box (Date), say suppose 10/10/2018 and user selects days of comparison as 3

10/10/2018 -3 = 07/10/2018

then the sales for 07/10/2018 should get displayed 

shiveshsingh
Master
Master

@pradosh_thakur  - My bad 😞 

Greater than and less than sign was not placed correctly

shiveshsingh
Master
Master

sum({< Sold_Date = {"<=$(=max(Date))>=$(=Date(max(date)- compday)"} >} quantity_sold)
- sum({< Sold_Date = {"<=$(=max(Date))>=$(=Date(max(date)- compday)"} >}quantity_returns)

 

Can you try this once?

When you'll select the date from list box which have Date Field, then max(Date ) will become the date which you selected and compday is the number of days which you'll select for comparison.

sakshikaul
Creator II
Creator II
Author

Hi 

I have a query regarding a data model structure.

I have following inline table which contains the event dates ie start date and end date now I want when user selects the date range lets say 5/07/2018 to 10/10/2018 the corresponding sale for that particular period should be displayed so for that I want to link this inline table with the main table . so how can I do that?

paint.png

 

 

Event:
load *

INLINE [

LastDate,currentDate, Event

 5/07/2018, 10/10/2018,Durga pooja

 10/09/2018,15/10/2018,Diwali

];