# QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Rules, plus terms and conditions, can be found here.
Not applicable

## Relationship between tables

Hi all.

I'm trying to solve this problem.

How do I cross the tables below to calculate:

Full potential of 2015

or Full potential by product

(Answer should be A = 3700 ; B = 300)

Tks a lot!!

Sales per Year

CityCódYear of ProductionQtd
São Paulo120155
Rio de Janeiro120143
São Paulo220147
Rio de Janeiro3201310
Rio de Janeiro620155

Models

CódProduct
1A
2A
3A
4A
5B
6B
7B

Potential of maintenance

ProductYearPotential
A2015100
A2014150
A2013170
B201560
Tags (4)
4 Replies
Not applicable

## Re: Relationship between tables

Hi,

Try this (it's not very elegant but it should work) :

Full potential of 2015:

=sum({<[Year of Production]={"2015"}>*<[Year]={"2015"}>} Potential*Qtd)

Full potential by product:

=sum(if([Year of Production]=Year,Qtd*Potential))

Xavier.

Esteemed Contributor III

See attached

MVP

## Re: Relationship between tables

Yet another solution   - and I attached the QVW too:

MVP

## Re: Relationship between tables

Hi,

one solution could be also:

hope this helps

regards

Marco