Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
sakshikaul
Creator II
Creator II

how to write an expression for date range using variable

Hi,

I want to write an expression using variables start_date and end_date as shown in image

I want to show sales between the start_date and end_date. Both start_date and end_date are variables and these are text boxes

Now want to call both the variables in chart by writing expression using set analysis, Please help me in writing the same.

PAINT2.png

please help stalwar1

14 Replies
sakshikaul
Creator II
Creator II
Author

Hi

qvw attachement

sakshikaul
Creator II
Creator II
Author

Please help stalwar1‌, rubenmarinloveisfail

Anil_Babu_Samineni

Sure - Can you tell us Which sheet we need to look and explain little more, Which filters are happened and what you want to calculate?

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

Hi,

I want to write an expression using variables start_date and end_date as shown in image

I want to show sales between the start_date and end_date. Both start_date and end_date are variables and these are text boxes

Now want to call both the variables in chart by writing expression using set analysis.

I want when user will select an event and will select a corresponding even date (lastDate)

now if user wants to  know the sales on  pre event date ie sales before 10 days with respect to selected date

and after once we get the date in text box that date will become starting date and last date will be as an event date

so I need to write an expression for start date and end date in pivot chart. How to write an expression?

rubenmarin

Hi Sakshi, there is no data to test in this sample. In reduce data you can select keep possible values to at least have some data to play.

Anyway, the answer should be closer to:

Sum({<Start_Date={">=$(vLastYearDate)<=$(vCurrentYearDate)"}>} MetricField)


vLastYearDate is a variable with value: =Date('$(vCurrentYearDate)'-$(vComparisonDays))

vCurrentYearDate is a variable with value: =Date(lastDate)