Qlikview displays the data of the year before the selected time

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.