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: 
Not applicable

Bar Chart with many dimensions

Dear QlikSense-Community,

I have a question concerning creating a bar chart which I illustrate with the following example:

The table contains the four programs A, B, C and D. Additionally, the column 'Company' contains a 'Yes' if the program is available for companies, 'Yes' if the program is available for Universities, etc.

 

NameCompanyUniversityPrivate
Program AYesYesYes
Program BYesYesYes
Program C YesNoNo
Program DYesYesYes

I intend to create a bar chart which contains the number of programs which are available for companies, universities and private.


I would be glad if somebody could help me concerning this issue.


Best,

Oliver

6 Replies
sunny_talwar

Option 1: Use CrossTable Load:

Table1:

CrossTable (Area, Flag)

LOAD * INLINE [

Name, Company, University, Private

Program A, Yes, Yes, Yes

Program B, Yes, Yes, Yes

Program C, Yes, No, No

Program D, Yes, Yes, Yes

];

Dimension

Area

Expresison:

Count({<Flag = {'Yes'}>}Flag)


Capture.PNG

sunny_talwar

Option2:

Table1:

LOAD * INLINE [

Name, Company, University, Private

Program A, Yes, Yes, Yes

Program B, Yes, Yes, Yes

Program C, Yes, No, No

Program D, Yes, Yes, Yes

];

Dim:

LOAD * INLINE [

Area, Dim

Company, 1

University, 2

Private, 3

];

Dimension:

Area

Expression:

Pick(Dim,

Count({<Company = {'Yes'}>}Company),

Count({<University = {'Yes'}>}University),

Count({<Private = {'Yes'}>}Private))

Not applicable
Author

Hey Sunny, thanks a lot for your help!

I just realized that I have to create a pie instead of a bar chart. But I think that does not change the code right?

Additionally, I am relatively new to QlikSense. I have a table with a lot of entries, what do I have to replace in the following code so that it automatically uses the entries that I have in my excel file? (I am referring to Option 2 because it seems easier to me)

Table1:

LOAD * INLINE [

Name, Company, University, Private

Program A, Yes, Yes, Yes

Program B, Yes, Yes, Yes

Program C, Yes, No, No

Program D, Yes, Yes, Yes

];



And in which field do I enter this code:

LOAD * INLINE [

Area, Dim

Company, 1

University, 2

Private, 3

];


I am thankful for your help!

Best,

Oliver

sunny_talwar

This below would be replaced by your Excel

Table1:

LOAD * INLINE [

Name, Company, University, Private

Program A, Yes, Yes, Yes

Program B, Yes, Yes, Yes

Program C, Yes, No, No

Program D, Yes, Yes, Yes

];

Use your Excel file....

This below

LOAD * INLINE [

Area, Dim

Company, 1

University, 2

Private, 3

];

Needs to be added anywhere in the Script as a New island table which doesn't get linked to anything else within your application (Make sure you don't have a field called Area or Dim in your application)

Also, don't be scared off the CrossTable Load... It is a very useful function to know. Try reading about it here:

The Crosstable Load

Not applicable
Author

Hey Sunny,

I finally figured it out. Thanks again for your help! After copying it into the script, it is important to load the data again so that it gets updated.

Best,

Olli

sunny_talwar

Hahahaha yes, I thought it was obvious, but I guess I should have mentioned that

Please marking any helpful responses here to make sure others can benefit when they land on this page for answers

Qlik Community Tip: Marking Replies as Correct or Helpful

Best,

Sunny