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

Isolated restriction on chart expression

Hi all,

I need to user two different restriction from various field values in a single chart expression, but I want the one restriction should not affect another.

Eg : I have yearly sales of fruits which contains apple, orange, banana, grapes

In all fruits, i have six categories a,b,c,d,e,f vice versa for all the fruits.

Fruit

Category

Apple

a

b

c

d

e

f

g

h

Orange

a

b

c

d

e

f

g

h

Banana

a

b

c

d

e

f

g

h

Grapes

a

b

c

d

e

f

g

h

In the chart I Want show sales value of apple a,b category

Orange c,d

Banana e,f

Grapes h,i

But one restriction should not affect the other fruit sales value in the chart, I cannot play around with script editor or data modeling.

I want this to be get done on expression, Single or multiple

But in a single line chart.

Kindly help with this, Thanks in advance

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try like:

if( Fruit='Apple', Sum({<Category={'a','b'}>}Sales),

       if( Fruit='Orange', Sum({<Category={'c','d'}>}Sales),

            if( Fruit='Grapes', Sum({<Category={'e','f'}>}Sales),

                 if( Fruit='Banana', Sum({<Category={'g','h'}>}Sales)))))

View solution in original post

5 Replies
tresesco
MVP
MVP

Taking this as input, what exactly do you expect to look your output like?

eromiyasimon
Creator II
Creator II
Author

Hi Tresesco,

Thank you very much for the reply, This is just sample table

Each fruit contains the sales value over a period of year in every category.

i want line chart which shows all the fruits but the total value from specific category for each fruit in a expression.

Category Restriction for a single fruit should not be affecting others.

I hope i explained better, If not feel free to ask any questions

Thank you very much

tresesco
MVP
MVP

Perhaps you have explained better. But I could not follow. Try to create a sample qvw with representative data and let know your expected output against that; suggesting a solution would be easier for me.

eromiyasimon
Creator II
Creator II
Author

Hi Attached the sample data, I provided some requirements on that.

I hope it helps

tresesco
MVP
MVP

Try like:

if( Fruit='Apple', Sum({<Category={'a','b'}>}Sales),

       if( Fruit='Orange', Sum({<Category={'c','d'}>}Sales),

            if( Fruit='Grapes', Sum({<Category={'e','f'}>}Sales),

                 if( Fruit='Banana', Sum({<Category={'g','h'}>}Sales)))))