4 Replies Latest reply: Nov 18, 2012 8:28 AM by thelastfleeting

# How can I count without clicking on a table?

Hello,

I have an Excel file containing five columns: day, month, day types, employees and number of hours worked by an employee.

Example:

Days | Month | Days type     | Duration (hours)   | Employees

1      | January | weekend      |       8                  | Gerard

1      | January | weekend      |       5                  | Kevin

2      | January | normal day   |       10                | George

2      | January | normal day   |        3                 | Kevin

So, on Qlikview, I have 5 tables (fields): Day, month, day type, Duration and Employees.

I would like to create a graph where you can see the sum of hours in weekends per month without selecting the field "weekend" in the table.

This is similar to an "if" in an excel ... but on Qlikview, I can not.

In the script, I try with this code:

if ([type days] = 'weekend', Sum (Duration))

But I have to click on the "weekend" to see the results ... How can I do without clicking?

or I try to count how many weekend there are? with : count([Days type]='weekend')      but it'll count each line where there is a weekend. However, there are 1 weekend for the day 1...     count([Days type]='weekend') and DISTINCT Days    ... don't work too...

• ###### Re: How can I count without clicking on a table?

Hi if u want to show per month

aggr(sum{<day_type ={'Weekend"}>}duration),month)

• ###### Re: How can I count without clicking on a table?

It doesn't work... there is a problem with brackets?

• ###### Re: How can I count without clicking on a table?

The brackets are ok, but the quotes aren't. See attached example. Is that the sort of thing you're looking for?

• ###### Re: How can I count without clicking on a table?

It works , thank you

But I must add Distinct for days because without distinct it counts 2 times the weekend for the day 1.

count({<[Days type]={'weekend'}>} DISTINCT Days)