Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
rittermd
Master
Master

Calculation Issue

I have a field that is calculated in the script and it is returning the correct result.  It is called TotalPay

However, when I Sum(TotalPay) I get a much larger result.  Also, if I calculate TotalPay manually in the chart I get the same larger result.

This would make me believe that I have multiple rows that I am not seeing in the chart because the data is identical.  But the Sum is adding them all up.

How can I go about confirming this or determining what is wrong?

I have attached a screen shot of the data.  As you can see there is only 1 row displayed. 

Capture.PNG

1 Solution

Accepted Solutions
sunny_talwar

You can add RowNo() as Key to your table and then add Key to your table to see the unique id

View solution in original post

8 Replies
sunny_talwar

Are there joins taking place which are essentially multiplying the data? Right now, it seems that there are 4 rows which are getting added to give you 699.52 when you do Sum([Total Pay])

rittermd
Master
Master
Author

I inherited this code.

It is using 2 Mapping Loads and then taking the fields from this to calculate the Total Pay field. 

map_PayRate: Mapping Load TimeCodeID, [Pay Rate] Resident TimeType;

map_HourlyWage: Mapping Load Employee_ID, [Hourly Wage] Resident [FinalEmployee]

ApplyMap('map_hourlyWage',EmpID) * TimeWorked * ApplyMap('map_PayRate',"TimeCode") as [Total Pay]

This all looks normal to me.

sunny_talwar

Are there more then one EmpID in your table? Try this

Dimension

EmpID

Expression

Count(EmpID)

rittermd
Master
Master
Author

Did that with this filter active and the count is only 1.

rittermd
Master
Master
Author

I just did a Sum of each part that makes up the expression.  The [Job Hours Worked] sums to 32 instead of 8.  The hourly wage is fine. 

This is getting more confusing by the second.  Logically this tells me that I have 4 rows.  But I don't see them.

sunny_talwar

You can add RowNo() as Key to your table and then add Key to your table to see the unique id

rittermd
Master
Master
Author

That worked.  Now I see 4 rows in my table.  Now I need to figure out why.  Thank you.

sunny_talwar

Awesome