Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
VGO
Contributor
Contributor

I get double values when creating statistics boxes

Hello,

I have a problem when calculating totals of some data, like for example the total of the total amount per orders or the total number of kg of the products sold. It always get the double.

I have been reading some other issues in the community and one of the problem was solved by putting Sum(DISTINCT[Order Total Amount]) but the one in a statistics box doesn't allow you to put any expresion so I still get double.

qlik.png

 

As you can see in the image above, there are 4 orders on that date but it gives me a number of 8 with the total just double. I created a chart with the expression Sum(DISTINCT[Order Total Amount])  and it solves the problem in the chart but the box still the same.

 

I would appreciate any help here as I am new with Qlik and I really want to learn more.

 

Thanks

Labels (1)
3 Replies
Saravanan_Desingh

I think you are loading the Table twice.

To test this, add a Dropdown for ID_Order. Search for =Count(ID_Order)=1. If no rows selected, then all the rows have duplicate. In such case, surely you are loading the Table twice. You have to review your Data Model.

If you share your script, may be useful to review further.

VGO
Contributor
Contributor
Author

I just changed something in the script and now I get triple...

I don't knwo what you mean with a dropdown... I get now 12 total count when it has to be 4.

This is the scipt:

LOAD ID_Customer,
Customer_UserName,
Customer_Email,
First_Name,
Last_Name,
Address,
City,
PostCode,
Phone_Number,
Community
FROM
[D:\007_VGO\003_Data Base\.xlsx FILES\Test 1\Test 1.xls]
(biff, embedded labels);OLEDB CONNECT TO [Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=TEST 1;Data Source=LAPTOP-V0E16FJL\SQLEXPRESS;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=LAPTOP-V0E16FJL;Use Encryption for Data=False;Tag with column collation when possible=False];
LOAD ID_Order,
ID_Customer,
ID_ShippingDetails,
Order_Number,
Order_Date
FROM
[D:\007_VGO\003_Data Base\.xlsx FILES\Test 1\Test 1.xls]
(biff, embedded labels, table is Orders$);

LOAD ID_Cart,
ID_Order,
ID_Shipping,
[Order Subtotal Amount],
[Cart Discount Amount],
[Order Shipping Amount],
[Order Total Amount],
[Order Refund Amount]
FROM
[D:\007_VGO\003_Data Base\.xlsx FILES\Test 1\Test 1.xls]
(biff, embedded labels, table is Cart$);

LOAD ID_Coupon,
[Coupon Description],
[Coupon Type]
FROM
[D:\007_VGO\003_Data Base\.xlsx FILES\Test 1\Test 1.xls]
(biff, embedded labels, table is Coupon$);

LOAD ID_Market,
Market_Date
FROM
[D:\007_VGO\003_Data Base\.xlsx FILES\Test 1\Test 1.xls]
(biff, embedded labels, table is Market$);

LOAD ID_Market,
ID_Type,
Cost_of_Goods,
Wholesale_Quantity,
[Wholesale_Price/Unit]
FROM
[D:\007_VGO\003_Data Base\.xlsx FILES\Test 1\Test 1.xls]
(biff, embedded labels, table is Market_ProductType$);

LOAD ID_Order,
ID_Coupon,
[Coupon Code],
[Discount Amount]
FROM
[D:\007_VGO\003_Data Base\.xlsx FILES\Test 1\Test 1.xls]
(biff, embedded labels, table is Orders_Coupons$);

LOAD ID_Order,
ID_Product,
Quantity,
Item_Cost
FROM
[D:\007_VGO\003_Data Base\.xlsx FILES\Test 1\Test 1.xls]
(biff, embedded labels, table is Orders_Products$);


LOAD ID_Product,
Product_Name,
ID_Type,
Unit,
UOM
FROM
[D:\007_VGO\003_Data Base\.xlsx FILES\Test 1\Test 1.xls]
(biff, embedded labels, table is Products$);

LOAD ID_Type,
Product_Type,
Category
FROM
[D:\007_VGO\003_Data Base\.xlsx FILES\Test 1\Test 1.xls]
(biff, embedded labels, table is ProductType$);

LOAD ID_ShippingDetails,
FirstName_S,
LastName_S,
Address_S
FROM
[D:\007_VGO\003_Data Base\.xlsx FILES\Test 1\Test 1.xls]
(biff, embedded labels, table is ShippingDetails$);


LOAD ID_Shipping,
Shipping_Method

 

 

Brett_Bleess
Former Employee
Former Employee

I would recommend you spend some time on the following areas in the online Help:

https://help.qlik.com/en-US/qlikview/April2020/Subsystems/Client/Content/QV_QlikView/Loading_data.ht...

In particular the following two should be guiding your decisions:

https://help.qlik.com/en-US/qlikview/April2020/Subsystems/Client/Content/QV_QlikView/LoadData/best-p...

https://help.qlik.com/en-US/qlikview/April2020/Subsystems/Client/Content/QV_QlikView/application-per...

The Table Viewer in the Desktop client will show you your data model and you should be able to check the number of rows in each table, but it could be your expressions are creating Cartesian products too, so that would be the other thing to confirm.  The other area that may be useful to you is the Design Blog area of the Community:

https://community.qlik.com/t5/Qlik-Design-Blog/bg-p/qlik-design-blog

About the best I can offer with what you have provided, really need the QVW file in these situations to be able to help well.

Regards,
Brett 

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.