Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Conditional calculation

Hello everybody

I'm just beginning my work in qlik sense and I've been trying to solve a problem but I didn´t succeed so far.

I have a table  from a Call center with call dates and blanks (see below)

Call pick up
10/2/15 19:41
31/3/15 15:26
5/10/14 9:25

The dates of calls  refer to years 2014 and 2015.

With the function  count(year(call pick up )) the output is the total number of calls during 2014 and 2015 and is ok.

The problem is when I want to calculate the number of calls separately by year.

As the year is implicit in the data I tried something like this

if(year(call pick up)=2015,count(call pick up)

or instead

count({$<year(call pick up)={$("2015"}>} year (call pick up))

Can somebody help?

Thks in advance

Joao Pereira

1 Solution

Accepted Solutions
sunny_talwar

Did you try this:

Count(If(Year(call pick up) = 2015, [Call pick up]))


Basically add the if statement within the Count() function

View solution in original post

3 Replies
sunny_talwar

Did you try this:

Count(If(Year(call pick up) = 2015, [Call pick up]))


Basically add the if statement within the Count() function

Not applicable
Author

Hello Sunny

Thanks for your prompt response.

It works perfectly

Joao Pereira

sunny_talwar

Great

Just as an suggestion for improvement, you can create Year in script like this may be:

LOAD [call pick up],

          Year([call pick up] as Year

FROM Source

and can then use set analysis instead of if statement. Set analysis is much more efficient than if statements

Count({<Year = {2015}>}[call pick up])