Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
vidyasagar159
Creator II
Creator II

Bar Chart Trellis for more than 2 Dimensions.

Hello Everyone,

I am working on QlikSense. I know that we cannot use more than 2 dimensions in a Stacked Bar chart. So I have decided to create a multiple Barcharts with the 3rd dimension. Can someone please help with the logic. Please find the information below.

Dimension 1: YEAR (This goes on x-axis)

Dimension2: Fruits exp: Apple, Banana, Grapes (This goes to the colors)

Dimension3: if(aggr(sum(sales),company,year)>50,greater than 50',if(aggr(sum(sales),company,year)<50,'Less than 50',if(aggr(sum(sales),company,year)>50 and aggr(sum(sales),company,year)<100,'50 to 100',if(aggr(sum(sales),company,year)>100 and aggr(sum(sales),company,year)<200,'100 to 200')))). So i have 4 dimensions or Categories from this expression.

Measure: Sum(Sales)

Since I do not have an option to show 3 dimensions in one single bar chart. I want to split the bar chart into 4 based on my 3rd dimension expression.

Thanks in Advance,

-Vidya

11 Replies
sunny_talwar

That would be a good idea

vidyasagar159
Creator II
Creator II
Author

So this is how I fixed the issue. Thanks to the community and collaboration.

  • I created the Dimension3 in a Load script editor as

[Size Table]:

load

year,

company,

if(aggr(sum(sales),company,year)>50,greater than 50',if(aggr(sum(sales),company,year)<50,'Less than 50',if(aggr(sum(sales),company,year)>50 and aggr(sum(sales),company,year)<100,'50 to 100',if(aggr(sum(sales),company,year)>100 and aggr(sum(sales),company,year)<200,'100 to 200')))) as Size

resdient [Main Table]

group by year, Company;


  • Dimension2 i have created it in a dimension expression

if(wildmatch(Category1,'*Apple*') and Flag=0 then 'Green Apple',

if(Category2 = 'Grapes' and Flag =1 then 'Red Grapes',

'All other fruits'

)) as Fruits

  • Measure Expression: Now I want to split the bar charts based on the Size dimension.

Chart1: Sum({<SIZE={"greater than 50"}>}sales)

Chart2: Sum({<SIZE={"less than 50"}>}sales)

Chart3: Sum({<SIZE={"50 to 100"}>}sales)

Chart4: Sum({<SIZE={"100 to 200"}>}sales)

  • Now the final step is to convert all the Bar Charts into 100% stacked bars. To do so,

Sum({<SIZE={"greater than 50"}>}sales)/ AGGR(sum({<SIZE={"greater than 50"}>} total <year> sales)

,YEAR,category1,category2,Flag)

Final Result:

100%Stacked Bars.PNG

Thanks,

-Vidya