Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Airapport
Contributor
Contributor

How to build a chart by a difference of counts of the same values in different columns of a table?

I have a table of 2 columns, say, A and B.

Each column has numbers from 1 to 10

For each of these numbers I want to find out, if this number is present more often in column A or in column B

In Excel I could do this as the difference of CountIFs (on the picture). The chart shows a bar of height 1 at position 10, because number 10 is found 2 times in column A and 1 time in column B

Help me, please, how can achieve the save in QlikSense?

Labels (3)
1 Reply
SerhanKaraer
Creator III
Creator III

Hello Airapport,

It is easier if you can modify data model. First, you have to unpivot the tabular data.

SampleHorizontal:
LOAD floor(rand()*10)+1 as A, floor(rand()*10)+1 as B AutoGenerate 20;

SampleVertical:
NoConcatenate
LOAD A as Value, 'A' as Column Resident SampleHorizontal;
LOAD B as Value, 'B' as Column Resident SampleHorizontal;

Drop Table SampleHorizontal;

Then you can use "Value" as dimension and "Count({<Column={"A"}>} Value) - Count({<Column={"B"}>} Value)" as measure in your bar chart.

I hope it solves.