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: 
Aspiring_Developer
Specialist
Specialist

Filter data in qliksense chart

Hello All,

I have one dimension as Brand coming from backend table  having below values :-

Aspiring_Developer_0-1658408143631.png

 

Now , I have to show market share for these brands in a bar chart and I was facing some coloring issue so I created dummy dimension using value list and create bar chart using below expression :-

Dimension -=valuelist('BT','Plusnet','EE')

Measure= 

if(valuelist('BT','Plusnet','EE')='BT',
(Sum({<[Contract Length]={'12-months'},Brand={'BT'}>}[Contract Value])/Sum({<[Contract Length]={'12-months'},Brand={'Total Market'}>}[Contract Value]))
,

if(valuelist('BT','Plusnet','EE')='Plusnet',
(Sum({<[Contract Length]={'12-months'},Brand={'Plusnet'}>}[Contract Value])/Sum({<[Contract Length]={'12-months'},Brand={'Total Market'}>}[Contract Value]))

,if(valuelist('BT','Plusnet','EE')='EE',
(Sum({<[Contract Length]={'12-months'},Brand={'EE'}>}[Contract Value])/Sum({<[Contract Length]={'12-months'},Brand={'Total Market'}>}[Contract Value]))
)))

 

I am able to create chart and get appropriate colours using below :-

=Pick(match(
valuelist('BT','Plusnet','EE'),
'BT','Plusnet','EE'),
RGB(85,20,179),RGB(200,30,110),RGB(52,161,160))

But now the problem is I am unable t filter this data on the above Brand filter because the in chart I have used dummy dimension.

So, is there any other way to do it in which I can filter out the data as well ?

Also, the original brand dimension has 5 brand and I have to show the data only for 3 brands in my chart i.e BT , Plusnet, EE.

Can anyone please guide me with the right way to do it ?

Thanks in advance

Labels (1)
2 Solutions

Accepted Solutions
hic
Former Employee
Former Employee

I would do it without ValueList(). Try Brand as dimension and the following as measure:

Sum({<[Contract Length]={'12-months'},Brand-={'Total Market'}>}[Contract Value])
/
Sum({<[Contract Length]={'12-months'},Brand={'Total Market'}>} total [Contract Value]))

And the following as color:

Pick(match(
Brand,'BT','Plusnet','EE'),
RGB(85,20,179),RGB(200,30,110),RGB(52,161,160))

View solution in original post

hic
Former Employee
Former Employee

The following will work fine if you have Brand only as dimension:

Sum({<[Contract Length]={'12-months'},Brand-={'Total Market'}>}[Contract Value]) /
Sum({<[Contract Length]={'12-months'},Brand={'Total Market'}>} total [Contract Value])

It will then divide by the total value in the chart. But if you add a dimension, you don't want to divide by the total of the chart - you want to divide by the total of the month. So, you need to change the denominator:

Sum({<[Contract Length]={'12-months'},Brand-={'Total Market'}>}[Contract Value]) /
Sum({<[Contract Length]={'12-months'},Brand={'Total Market'}>} total <MonthName> [Contract Value])

View solution in original post

4 Replies
hic
Former Employee
Former Employee

I would do it without ValueList(). Try Brand as dimension and the following as measure:

Sum({<[Contract Length]={'12-months'},Brand-={'Total Market'}>}[Contract Value])
/
Sum({<[Contract Length]={'12-months'},Brand={'Total Market'}>} total [Contract Value]))

And the following as color:

Pick(match(
Brand,'BT','Plusnet','EE'),
RGB(85,20,179),RGB(200,30,110),RGB(52,161,160))

Aspiring_Developer
Specialist
Specialist
Author

Hi @hic 

Thank you for your response. I followed your approach and I am able to do the selections. However, it is giving me issue at an overall level.

I created the stack bar chart like below :-

Aspiring_Developer_0-1658481227491.png

 

It is giving me 1% for all because my numerator and denominator  is showing same values :-

Sum({<[Contract Length]={'12-months'},Brand-={'Total Market'}>}[Contract Value])
/
Sum({<[Contract Length]={'12-months'},Brand={'Total Market'}>} total [Contract Value])

But when  I took them seperately in KPI it is giving me different values:-

Aspiring_Developer_1-1658481447862.png

But when I make any selection on a particular month it is giving me correct result like below :-

Aspiring_Developer_2-1658481583775.png

 

Not sure, why it is impacting at an overall level. Can you please help ?

Thanks in advance

 

Aspiring_Developer
Specialist
Specialist
Author

Hello @hic 

I also checked that when I am taking total in denominator it is giving me this value  without month filter:-

Aspiring_Developer_0-1658485750059.png

And when we apply month filter it changes the total and start giving correct percentage :

Aspiring_Developer_1-1658485815453.png

So, I tried to use aggreagtion , but it didn't worked:-

Sum(total aggr(sum([Contract Value]), Brand))

Thanks

hic
Former Employee
Former Employee

The following will work fine if you have Brand only as dimension:

Sum({<[Contract Length]={'12-months'},Brand-={'Total Market'}>}[Contract Value]) /
Sum({<[Contract Length]={'12-months'},Brand={'Total Market'}>} total [Contract Value])

It will then divide by the total value in the chart. But if you add a dimension, you don't want to divide by the total of the chart - you want to divide by the total of the month. So, you need to change the denominator:

Sum({<[Contract Length]={'12-months'},Brand-={'Total Market'}>}[Contract Value]) /
Sum({<[Contract Length]={'12-months'},Brand={'Total Market'}>} total <MonthName> [Contract Value])