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: 
ishanbansal1204
Contributor III
Contributor III

100% stack bar chart

Hi All,

I am working on creating 100 % stack bar chart.

i have selected dimensions as week and category

category includes

IF (Aggr(Sum(AMOUNT_CLIENT), [CLIENT],[YEAR],[WEEK]) < 10, 'Spender 1')

this if conditions different types of spenders.

my measure has count(distinct client)

value wise data is displayed fine but i want to convert the value into % (100 % stack bar chart)

can some one pls suggest .

22 Replies
sunny_talwar

May be try an expression like this:

Count(DISTINCT client)/Count(DISTINCT TOTAL <WEEK> client)

ishanbansal1204
Contributor III
Contributor III
Author

hi,

Thanks for your support. But when i tried this i am getting 400%.

sunny_talwar

You have Week as your first dimension, right?

ishanbansal1204
Contributor III
Contributor III
Author

yes. I have week has the first dimension.

sunny_talwar

Your second dimension has only one value?

If(Aggr(Sum(AMOUNT_CLIENT), [CLIENT],[YEAR],[WEEK]) < 10, 'Spender 1')

Nothing for when the condition is not met? Could that be the reason? I can't really say much without seeing what you have today? Can you share a sample?

ishanbansal1204
Contributor III
Contributor III
Author

I Have multiple if statements which follows as spender 3, spender 4 , spender 5...

sunny_talwar

Can you create a straight table with Week and your calculated dimension as your dimensions and two expressions

1) Count(DISTINCT client)

2) Count(DISTINCT TOTAL <WEEK> client)

Can you check if the second expression is totaling your Count of distinct client over any particular week?

ishanbansal1204
Contributor III
Contributor III
Author

both the expression are giving out same values

ishanbansal1204
Contributor III
Contributor III
Author

In your example. when i am selecting 2015, i am getting max of year that is 2016

Note : i have this expression as dimension as i am using bucketting.

and in the measure i am using

Count(({1<WEEK={"<=$(=Max({<Year = {$(=Max(Year))}>}WEEK))"}, Year = {$(=Max(Year))}>} DISTINCT CLIENT)