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: 
Anonymous
Not applicable

How to manage total outlets vs ordered outlets in data model

I am trying to manage tables for total outlets vs ordered outlets in QVW but getting LOOPs.

Is anyone have solution for this issue. Please help to sort out it.

   

Table: Schedule_Outlets
Outlet_CodeSales_Man_CodeCategoryID
T000190030040051003A001
T000190030040031003A001
T000190030040061003A001
T000190030040091003

A001

Table: Product
CategoryIDProductCodeProductName
A00130008Chocolate 200g
A00130009Chocolate 300g
A00130010

Milk Chocolate 200g

Table: Order
OrderIDOrder_DateProductCodeOutlet_Code
AZ161004576905/01/201630009T00019003004003
AZ161004576905/01/2016300010T00019003004003
AZ161004577006/01/201630008T00019003004006
AZ161004577006/01/201630009T00019003004006
AZ161004577006/01/201630010T00019003004006

How to join these tables because I am getting "LOOP" when I join then in QVW

I need following results.
ProductCodeFrom_DateTo_DateTotal_Schedule_OutletsTotal_Productive_Outlets%age
3000905/01/201606/01/201642
4 Replies
swuehl
MVP
MVP

Maybe like this:

SET DateFormat = 'DD/MM/YYYY';

[Schedule_Outlets]:

LOAD Outlet_Code as Scheduled_Outlet_Code, Sales_Man_Code, CategoryID

INLINE [

Outlet_Code, Sales_Man_Code, CategoryID

T00019003004005, 1003, A001

T00019003004003, 1003, A001

T00019003004006, 1003, A001

T00019003004009, 1003, A001

];

Product:

LOAD * INLINE [

CategoryID, ProductCode, ProductName

A001, 30008, Chocolate 200g

A001, 30009, Chocolate 300g

A001, 30010,Milk Chocolate 200g

];

Order:

LOAD * INLINE [

OrderID, Order_Date, ProductCode, Outlet_Code

AZ1610045769, 05/01/2016, 30009, T00019003004003

AZ1610045769, 05/01/2016, 300010, T00019003004003

AZ1610045770, 06/01/2016, 30008, T00019003004006

AZ1610045770, 06/01/2016, 30009, T00019003004006

AZ1610045770, 06/01/2016, 30010, T00019003004006

];

Then create a straight table chart with ProductCode as dimension and four expressions:

=Date(Min(Order_Date))

=Date(Max(Order_Date))

=Count(DISTINCT Scheduled_Outlet_Code)

=Count(DISTINCT Outlet_Code)

ProductCode From To Count(DISTINCT Scheduled_Outlet_Code) Count(DISTINCT Outlet_Code)
3000806/01/201606/01/201641
3000905/01/201606/01/201642
3001006/01/201606/01/201641
30001005/01/201605/01/201601
Kushal_Chawda

Rename Outlet_code from any of the Table, then load all the table, now there will not be any loops

Anonymous
Not applicable
Author

Thanks for your reply...

Now if I want to add "Outlet Master" table with this data model and need to join 'Outlet_Code' with both Scheduled & Order table then how it is possible.

like

Outlet_Master:

LOAD * INLINE [

Outlet_Code, Outlet_Name, Outlet_Type

T00019003004005, ABC Store, Retailer

T00019003004003, AA Super Store, Super Store

T00019003004006, BB General Store, General Store

T00019003004009, AB General Store, General Store

];