Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Loop problem (modeling)

Hello all,

i need an advice to solve this problem:

i have 4 table:

LOOP (1).png

for each area (site) i need to show its AreaTypeId(SiteTypeId) AreaQty(SiteQty) and its OrderQty, something like that:

table.bmp

but the problem is  connection between AreaTypeId  and TypeID because for each AreaTypeId  i need to connect it to PartID and sum the OrderQty.

by connecting the fields i get a loop.

any idea how to do that?

thank you all.

17 Replies
Not applicable
Author

Someone?

vijay_iitkgp
Partner - Specialist
Partner - Specialist

Hi,

Your question is not very clear. Can you please send us some sample data in xls for all tables u mentioned.

rohit214
Creator III
Creator III

Hi

avifarkash

For getting correct data you have to make Composite Key

e.g. AreaTypeId  &TypeID  as #_KEY     and using this key connect each other table

else send me your application

thanks

rohit

Not applicable
Author

Hi,

Thank you for helping!!!

i have attached a qvw file.

i will explain what is the desired result:

i have 4 tables:

1. log - for each orderID i have the its time, order quantity, and order type

2.hirar - Area -> Site -> Order

3.Min Area - for Order Type id under area i have the minimum amount.

4.Min Site - same as above but for sites.

now i need to present 2 tables:

1. Area Suming: will show area name , all order type id of the area, area minimum amount, sum of order qty.

2. same as above but for site.

i hope it was clear now, if not please ask me...

Thanks a lot.

Avi

Not applicable
Author

Someone?

hic
Former Employee
Former Employee

If you want a data model with several tables, you need to make a composite key just like Rohit suggests. The reason for this is that your attributes in MinArea and MinSite touch both the dimensions defined by OrderID and OrderTypeID.

However, there is a simpler way: Start by loading the transaction table (log), then join the other tables onto this table. First the Hierarchy table, then the other tables.

LOAD * FROM log.qvd (qvd);
Left join LOAD * FROM hirar.qvd (qvd
);
Left join LOAD * FROM MinArea.qvd (qvd
);
Left join LOAD * FROM MinSite.qvd (qvd
);

This way you will have only one table – a table that has a few extra columns but has the same length as the log file. So it will still be a good solution.

rohit214
Creator III
Creator III

Hi Avi

I dont have your data so i cant reload to chek it,

but try this,

1)in Min Area    table alias OrderTypeID to Order_Type_ID

2) In Log table alias OrderTypeID to OrderType_ID

and let me know its working or not

thanks

rohit

Not applicable
Author

Thank you Henric ,

i have thought about your sulotion the only problem is that if there is for Site or Area a minimum and there is no log (OrderID under Site or Area) i need to show the minimum amount and 0 in sum of order qty.

Not applicable
Author

hi rohit and thank you for helping,

i didnt understand you sulotion .

i have attached a qvd files.

i hope its ok.

avi