Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Qlik Sense Cookbook

You're reading from   Qlik Sense Cookbook Over 80 recipes on data analytics to solve business intelligence challenges

Arrow left icon
Product type Paperback
Published in Aug 2018
Publisher Packt
ISBN-13 9781788997058
Length 334 pages
Edition 2nd Edition
Arrow right icon
Authors (3):
Arrow left icon
Philip Hand Philip Hand
Author Profile Icon Philip Hand
Philip Hand
Neeraj Kharpate Neeraj Kharpate
Author Profile Icon Neeraj Kharpate
Neeraj Kharpate
Pablo Labbe Pablo Labbe
Author Profile Icon Pablo Labbe
Pablo Labbe
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Getting Started with the Data FREE CHAPTER 2. Visualizations 3. Scripting 4. Managing Apps and the User Interface 5. Useful Functions 6. Set Analysis 7. Using Extensions in Qlik Sense 8. Advanced Aggregation with AGGR 9. Tips and Tricks 10. Other Books You May Enjoy

Setting up a moving annual total figure


A moving annual total (MAT) is the total value of a variable, such as sales figures for a product, over the course of the previous 12 months. This is a rolling yearly sum, so it changes at the end of each month with data from the new month added to the total and data from the first month of the period taken away. You can read more about MAT at http://www.pmlive.com/intelligence/healthcare_glossary_211509/Terms/m/moving_annual_total_mat.

Getting ready

We are going to make use of variables in this recipe. We will define three variables in the script: vMonthFormat, vRolling12Months, and vMaxMonth. Load the following script into your Qlik Sense application:

LET vMonthFormat = 'MMM-YYYY'; 
LET v12MonthsBack = 'Date(AddMonths(max([MonthYear]), - 
   12),$(vMonthFormat))'; 
LET vMaxMonth='Date(max([MonthYear]),$(vMonthFormat))'; 
 
 
Sales: 
LOAD 
Date(Date#(MonthYear, 'MMMYYYY'), 'MMM-YYYY') as MonthYear, 
Month(Date#(MonthYear, 'MMMYYYY')) as Month, 
Year...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime