Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

twanqlik
New Contributor II

Data model - avoiding loop?

I can use some help with my data model

I have 2 dimensions in my data model that are using the same field:

test.png

  1. Dim_SourceSystem
  2. Dim_BMC

The field that in both dimensions is used is: Business_Code

Renaming one of the fields is no option because:

- On the front-end the user should be able to filter on a business_code that will filter in both the dimensions.

How my calculation should work:

  1. User selects one or more business codes
  2. Qlikview calculates the count on [Distinct CONSUMER_ID] in the FACT_Consumer_Sell_Out table.

Linking the 2 Business_Code fields results in a loop. I currently have no idea how to fix this. Help

Background:

a) product registrations are linked to a business code

b) the used source code is sometimes also linked to a business code

A consumer can have a product registration, the product registration is linked to a Business_Code

A consumer registration has always a source code, and a Business_Code is sometimes linked to a source code.

The user wants to know how many consumers belong to his Business Code, that are consumers with and without a product registration.

8 Replies

Re: Data model - avoiding loop?

I think I would transfer Business_Code into the fact-table probably with one (or two nested) mapping(s) and applymap() and removing them from the dimension-tables.

- Marcus

spividori
Valued Contributor

Re: Data model - avoiding loop?

Hi.

Could you attach an excel sheet with data to help you ?.

Regards.

twanqlik
New Contributor II

Re: Data model - avoiding loop?

Yes of course, please find attached a sample

jcampbell474
Contributor III

Re: Data model - avoiding loop?

Please reload the attached.

twanqlik
New Contributor II

Re: Data model - avoiding loop?

Thank you Jason, however i don't see any difference in your attachment?

jcampbell474
Contributor III

Re: Data model - avoiding loop?

I commented out your script and added Tab 2 in the Script Editor.  I can't reload because I don't have the source data.

spividori
Valued Contributor

Re: Data model - avoiding loop?

Hi.

See the attachment. Hope this helps.

Regards.

twanqlik
New Contributor II

Re: Data model - avoiding loop?

Thanks Sandro, but it's not completely working.

When I select consumerID 8 none of the business unit codes are selected, but the business unit code '0368' should be selected.

Any ideas on how to improve?

Community Browser