Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

on selection of date in the calender. the charts should reflect the sales

Hi

i need on selection of date from calender ( if i will select date as 12th dec 2015 to 13th dec 2017)then sales of 2015 should reflect under text box named prev_year(in blue) in charts and sales of curr_year(in blue) in chart.

so for that how to declare variable for calender and how to use it ?paint3.png

5 Replies
its_anandrjs

From calendar object pass the date values to two variables and then use

=Sum({<Date ={">$(vFromDate)  <=$(vToDate)"} >}  Value)

Or

=Sum({<Date ={">$(=vFromDate)  <=$(=vToDate)"} >}  Value)



And with other SET expression also.

Anil_Babu_Samineni

May be apply for Background color like, As always you are superb my dear ... Try to provide genuine business and explain more clear your intend ..!

If(DateField = Date($(Prev_Year),'DD-MMM-YYYY') and DateField = Date($(Curr_Year),'DD-MMM-YYYY'), Blue())

OR

If(DateField >= Date($(Prev_Year),'DD-MMM-YYYY') and DateField <= Date($(Curr_Year),'DD-MMM-YYYY'), Blue())

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
Author

for prev_year i am using following expression now should i combine both of the?

=num(SUM({$<Sold_Date = {'>=$(=Addyears(YearStart(Today()),-12))<=$(=AddMonths(MonthEnd (Today()),-12))'}>}([inv value]))/Sales_INR_Unit,

'#,##0.0')

its_anandrjs

Check this tread

Date Range using Calendar Object | Qlik Community

The Basics about Dates, Date Ranges and Set Analysis

The expression that you shown is not requied here you have to add StartDate and end date variable in your expression.

Anonymous
Not applicable
Author

SET v_STARTDATE = '01/01/2016';

SET v_ENDDATE = '31/12/2016';

TMP_DATE_1:

LOAD date(date#('$(v_STARTDATE)','DD/MM/YYYY')-1 + recno() ,'DD/MM/YYYY') as Date

AUTOGENERATE (date#('$(v_ENDDATE)','DD/MM/YYYY') - date#('$(v_STARTDATE)','DD/MM/YYYY')) + 1 ;

TMP_DATE_2:

LOAD

Date

RESIDENT TMP_DATE_1;

DROP TABLE TMP_DATE_1;

this is fine for this?