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

Announcements
Only at Qlik Connect! Guest keynote Jesse Cole shares his secrets for daring to be different. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
nigel987
Creator II
Creator II

Used variable and dimension exclude each other

Hi,

I have following issue and would appreciate any advice.

My data model is quite complex so I tried to translate it to a more simple scenario.

I have several cars (field 'car') in my database.

Each car can (but does not need to) have special products (field 'product').

These products can be categorized; so each product is either a "main_feature" or an "additional_feature" (field 'product_type', values = main feature or additional feature).

I want to calculate and display the following variable (the average money I make with additional feature for every sold main feature):

Sum({$<product_type={'additional_feature'}>} Price)/Count({$<product_type={'main_feature'}>} feature_ID)

This is working fine, but I want to display the result for each additional_feature. When I select the dimension 'product', it just shows the total value.

Is this clear? Does anyone know how I would need to modify my variable?

Thanks and KR

1 Solution

Accepted Solutions
marcus_sommer

You need to make your expressions independent from any or certain selections. This could be done with adjusted identifier and qualifier like:

Sum(1 {$<product_type={'additional_feature'}>} TOTAL Price)

A good explanation will you find here: Set Analysis: syntaxes, examples

- Marcus

View solution in original post

4 Replies
nigel987
Creator II
Creator II
Author

Hi, does nobody have an idea?

Thanks!

simenkg
Specialist
Specialist

Try:


Sum({$<product_type={'additional_feature'}>} Price)/Count({$<product =,product_type={'main_feature'}>} feature_ID)

jonathandienst
Partner - Champion III
Partner - Champion III

Your requirement is not really clear. I suggest that you post a sample qvw containing representative data and your expected results.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
marcus_sommer

You need to make your expressions independent from any or certain selections. This could be done with adjusted identifier and qualifier like:

Sum(1 {$<product_type={'additional_feature'}>} TOTAL Price)

A good explanation will you find here: Set Analysis: syntaxes, examples

- Marcus