1 Reply Latest reply: Dec 1, 2015 8:57 PM by Marcus Sommer

# Problem in adding duplicated data in computation

I have a problem in my data and still I cant get over it. Heres my data;

yr(Effectivity year)

year(year of payment)

```PIN        OwnerNum      owner       year           yr        ToTalTax
pin123     1000          data1       2015          2016       1,000
pin123     1000          data1       2015          2014       1,100
pin123     1000          data1       2015          2013         900
pin456     1000          data2       2015          2009       2,000
pin456     1000          data2       2015          2008       1,000
```

TotalTax is computed using this expression;

```sum({<year1= {"2015"},PayPenalty={"<=0"}>} aggr(DISTINCT PayBasic,year1,OwnerNum,BINum,PCINum,SINum,MDINum,Parcel,PType))
+ sum({<year1= {"2015"},PayPenalty={"<=0"}>} aggr(DISTINCT PaySEF,year1,OwnerNum,BINum,PCINum,SINum,MDINum,Parcel,PType))
- sum({<year1= {"2015"},PayPenalty={"<=0"}>} aggr(DISTINCT PayDiscount,year1,OwnerNum,BINum,PCINum,SINum,MDINum,Parcel,PType))
```

PIN is compose of (BINum,PCINum,SINum,MDINum,Parcel,PType)

What I want is to compute the first data whose effectivity year <=2015. I want to display this data on my straight table and Bar graph.

;

```PIN        OwnerNum      owner       year           yr        ToTalTax

pin123     1000          data1       2015          2014       1,100

pin456     1000          data2       2015          2009       2,000

```

See Data Model in my attachment..

• ###### Re: Problem in adding duplicated data in computation

I think you will need at first to rethink your datamodel and adjust the associations between the tables then there are a lot of synthetic keys. Have a special look on the first three links in Get started with developing qlik datamodels.

- Marcus