# New to QlikView

Discussion board where members can get started with QlikView.

Not applicable

## help with set analysis

Good morning,

I am struggling with this problem that involves set analysis. My objective is to calculate the count of inspections but considering different weights for each Category (2 and 3 have double weight) if MotivoID is 1, because if it is 2 should be single weight as it is for categories 1, 6 and 7.

My code is:

= (if(Ano > 2011 and MotivoID <> 2,

( 2 * Count({\$< CategoriaID = {"2"} >}  InspeccaoID ) +

//          Count({\$< CategoriaID = {"2"} >}  InspeccaoID ) +

//          Count({\$< CategoriaID = {"3"} >}  InspeccaoID ) +

2 * Count({\$< CategoriaID = {"3"} >}  InspeccaoID ) +

Count({\$< CategoriaID = {"1"} >}  InspeccaoID ) +

Count({\$< CategoriaID = {"6"} >}  InspeccaoID ) +

Count({\$< CategoriaID = {"7"} >}  InspeccaoID )

))

+

if(Ano > 2011,

count({\$ <[MotivoID] = {"2"}>} InspeccaoID)))

So far it hasn't gave me the results I am looking for.

Any help will be very helpful.

afonso

Tags (2)
4 Replies
Contributor

Try this url

Gr. Sandeep

Highlighted
Contributor

## Re: help with set analysis

Would you be so kind to send me a small file with an inline table which gives me a small example containing the fields:

Ano, MotivoID, CategoriaID and InspecaoID

In the meantime you can also use this document:

Not applicable

## Re: help with set analysis

I think I managed to find a solution that solve my problem.

Thanks to all that try to help me.

Not applicable

## Re: help with set analysis

Thanks Sandeep. With all this notes I managed to solve my problem.

Best regards,

Afonso Lopes