Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
On Demand Webinar: See Why Thousands of QlikView Users Have Switched to Qlik Sense. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Year function in SUM expression

Hello!

I have a dataset like this:

sales_date   sales_value

12/31/2016   564

12/30/2016   487

12/29/2016   784

12/28/2016   231

12/27/2016   389

12/26/2016   474

12/25/2016   671

12/24/2016   600

...                ...

I'm trying to create an expression to create a line graph, in which each line of the graph represents the sales per month of a specific year. I was planning to create such expression gradually, but I'm having trouble even with the simple stuff. What I have right now is

SUM({$<year(sales_date)={2016}>} sales_value)

But it's giving me and expression error. What is wrong with this simple statement?

(Btw, I'm finding the Qlik's syntax quite complicated. Is there some sort of expression debugger to help us find out what is wrong with our code? Thanks!)

4 Replies
ger_alegria
Partner
Partner

You have to create the year field first.

Load

     sales_date,

     sales_value,

     year(salesdate) as Year,

     Month(Ssales_date) as Month

From...

and after that in the expresion:

sum({<Year={'2016'}>}sales_value)

let me know if it helps you.

Not applicable

Cant I use year(sales_date) instead?

ger_alegria
Partner
Partner

No, if you use this sintaxys Qlik will show an error in expression.

Not applicable

Don't forge to put values in single quotes