Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Welcome to Qlik Community! Check out our new navigation! FIND OUT MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
noviceqlik
Contributor III
Contributor III

stacked bar chart with two dimensions and 1 mesure

Hi all,

I am having trouble trying to make a stacked bar chart with two dimensions and 1 measure. Any help is appreciated - thank you. I have added the sample data.

This is the sample chart that I want to replicate in Qlik sense:

Capture.PNG

1 Solution

Accepted Solutions
PabloTrevisan
Partner - Creator II
Partner - Creator II

Hi !

Here is the solution for you.

I hope it help's you !

Waiting your feedback, good luck.

View solution in original post

9 Replies
PabloTrevisan
Partner - Creator II
Partner - Creator II

Hi !

Here is the solution for you.

I hope it help's you !

Waiting your feedback, good luck.

noviceqlik
Contributor III
Contributor III
Author

wow super, thank you!

2 questions related:


(1) How can I exclude specific variables, for example, I would like to exclude class 'c' or product 'apples' from the chart?

(2) How I can change the chart to 100% stacked bar chart. For example, I want to sum each 'product' in each 'class' and 'year' as a percentage of the in total in the 'class' and 'year'

PabloTrevisan
Partner - Creator II
Partner - Creator II

Hi, I'm happy to help you.

Here is the .qvf with your two questions, please if my answer resolved your question, don't forget to mark as "Correct Answer".

Look that I've created two metrics.

exemple1.jpg

noviceqlik
Contributor III
Contributor III
Author

Hi Pablo,

I added example.qvf but I cannot find the answers to my two questions.

Can you help me find them please?

ChennaiahNallani
Creator III
Creator III

(1) How can I exclude specific variables, for example, I would like to exclude class 'c' or product 'apples' from the chart?


=if(product <> 'apple',product)


(2) How I can change the chart to 100% stacked bar chart. For example, I want to sum each 'product' in each 'class' and 'year' as a percentage of the in total in the 'class' and 'year'


tab1:

LOAD

    product,

    "class",

    weight,

    "year",

    class&'-'&year as ClassYear

FROM [lib://doc/sample.xlsx]

(ooxml, embedded labels, table is Sheet1);

diments = ClassYear, product

Expresion = sum(weight)/sum(total ClassYear weight)

PabloTrevisan
Partner - Creator II
Partner - Creator II

Hi,

Sorry, my fault !

Here the correct .qvf

exemple1.jpg

noviceqlik
Contributor III
Contributor III
Author

thank you very much!

Q1: Works really well. Any idea how to sort from largest to smallest i.e. largest stacks are on the bottom?

Q2: I need a 100% stacked bar for each class and year. Can you help me again please?

noviceqlik
Contributor III
Contributor III
Author

(1) How can I exclude multiple objects such as 'apple' in Product and 'c' in Class in one single expression?

(2) I will try this

noviceqlik
Contributor III
Contributor III
Author

2) did not work. No bars appeared at all, the chart is completely blank