Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
jason_nicholas
Creator II
Creator II

calculation error in set analysis

I have a calculation in a table chart which isn't generating the same results as it would if I ran it manually on an Excel sheet. I would appreciate a review and any suggestions on where I am going wrong.

I have a table chart with Month as the dimension, and a calculated expression of:

SUM({$<[Charge Type]={'Event Charge'},Region={'EMEA'}>}[Calculated Total]

[Calculated Total] is an expression in my load script:
LOAD *,
[Item Quantity]*[Item Unit Price]*[Hours] as [Calculated Total] ;

LOAD [Booking ID], //key
Month([Booking Date]) as Month,
[Item Quantity],
[Item Unit Price],
Hours,
Resource as Support,
[Building Time Zone] ,
FROM
[..\DataSources\AV Support 2017.xls]

I use inline loads to group certain [Support] entries into {'Event Charge'} and certain [Building Time Zone] entries into {'Regions'}.

In my table chart, the expression results in a total of $81,096 for the month of January

If I then build a straight table with columns for[Item Quantity], [Item Unit Price] and [Hours]; along with one for [Support] and one for [Booking ID] to ensure a separate line item for each possible chargeable resource, I can then filter by selecting {'Event Charge'}, {'EMEA'} and {'Jan'} from selection objects, and export the resulting table to Excel for manual calculation.

In the Excel doc, I multiplied the [Item Quantity] by the [Item Unit Price] by the [Hours] and sum them together to get a total of $33,646, which is also the total generated from the previous method (which QV is intended to replace). I can't seem to figure out why the function above is generating a total more than twice what the manual calculation generates.

It may be worth noting that the data in [Item Quantity], [Item Unit Price] and [Hours] only comes in alignment with the [Support] resources in question. There are no other dollar amounts in the data set, except for those excluded by the {'Event Charge'} filter.

10 Replies
sunny_talwar

Unlike Join, the purpose of KEEP is to keep the tables separate. Read more about it here:

Understanding Join, Keep and Concatenate