Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Qiyanlu66
Partner - Contributor III
Partner - Contributor III

How to sum multiple dimensions into one in the bar chart.

Hello everyone,

 I have a table like this , ColA,ColB, ColC would only be one of Apple, Banana, orange.

ID,ColA, ColB, ColC

1,apple,banana,orange

2, banana,apple,orange

3, orange,banana,apple

4,.............

 

So how do I create a one dimension bar chart that count through apple ,banana, orange for all three columns ?

 

Thanks everyone.

2 Replies
rachel_delany
Creator II
Creator II

I think the best solution would be to change the actual data model by unpivoting your data so that ColA, ColB, ColC are just one column.

See the link below for a guide to unpivoting in the data manager:

http://help.qlik.com/en-US/sense/June2019/Subsystems/Hub/Content/Sense_Hub/LoadData/unpivot-crosstab...

Or if you'd prefer to do it in the load script you can use the Crosstable prefix:

https://help.qlik.com/en-US/sense/June2019/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptPrefixes...

treysmithdev
Partner Ambassador
Partner Ambassador

I would modify the data itself to be something like:

IDColumnTypeValueCounter
1A

apple

1

1Bbanana1
1Corange1
2Abanana1
2Bapple1
2Corange1
3Aorange1
3Bbanana1
3Capple1

 

Then have your dimension be Value and your expression be:

Sum(Counter)

. This would be performant and also give you the flexibility to only show one column type if needed using: 

Sum({<ColumnType={'A'}>} Counter)

 

 

Blog: WhereClause   Twitter: @treysmithdev