Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
bhaveshp90
Contributor III

Error in Expression - Duplicate Values

Hello, 

I have a table below as shown below. I have my expression for OEC - Current as 

 =If(Num_Month = '$(vPreYearLastMonth)' and Year = '$(vPreYear)', 0, Sum(Updated_OEC_Budget)) 

Sum(Updated_OEC_Budget) = 179922+522900 = 702822; but the expression is wrong (Duplicate Values as you see below).

1.PNG

 

Can anyone help me how to fix these duplicate values? Attached is the qvd and qvw file

 

thanks

Bhavesh

 

5 Replies
jduenyas
Contributor III

Re: Error in Expression - Duplicate Values

try this:

=If(Num_Month = '$(vPreYearLastMonth)' and Year = '$(vPreYear)', 0, Sum(AGGR(Updated_OEC_Budget,  Cost-Code)))

bhaveshp90
Contributor III

Re: Error in Expression - Duplicate Values

@jduenyas that expression works for Total, but when I change the Engineering_Area the value becomes 0 

bhaveshp90
Contributor III

Re: Error in Expression - Duplicate Values

@sunny_talwar@jontydkpi@swuehl, Can you please look into this problem? 

 

 

MVP
MVP

Re: Error in Expression - Duplicate Values

It seems like one of the joins or the logic in the load script is causing duplicate records. Your data model may need to be changed to better suit your analysis.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Donicc
New Contributor II

Re: Error in Expression - Duplicate Values

As a test, try removing the NCC_Code column and see if the duplicates are removed.  Looks like you are getting a row for each distinct value of NCC_Code.