The customer often asks for this. When the user selects a time, the data of the year before the selected time is displayed in the chart. The following is my method. If there is any improper method, please advise:
Data preparation is as follows:
Salesdata: loadnum (ID) as ID, date (date) as date, month, num (year) as year, num (sales) as salesinline [ID, date, month, year, sales1, 2012-1-1 1, 2012-1, 2012,202,201 2-1-1 1, 2012-2, 2012,213,201 2-1-1, 2012-3, 2012,234,201 3-1-1, 2013-1, 2013,345,201 3-2-1, 2013-2, 2013,356,201 3-3-1, 2013-3, 2013,467,201 4-1-1, 2014-1, 2014,278,201 4-2-1, 2014-2, 2014,309,201 4-3-1, 2014-3, 2014, 49];
Create a chart:
Use month as the dimension ,:
Create an expression in the expression tab as follows:
The sales expression is as follows:
= Sum ({$ <date = {'>$ (= Date (max (date)-365) <= $ (= Date (max (date ))) '}>} sales)
Click "OK" and create a new date list, as shown in. If no date is selected, the sales chart displays the data of the past year by default:
If you select a time, the sales chart displays the data of the year before the selected date, as shown in. Because you select 2014-1-1 1, the sale chart displays the data of the year before the 2014-1-1 1.
Conclusion: The sales expression above proves that "> =", "<=" can be implemented in qlikview ". If you have any questions, please leave a message!
Qlikview displays the data of the year before the selected time