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: 
XavierL
Contributor
Contributor

Strings comparison, letter by letter

Hi community,

I started on Qlik several months ago and I use your advice every day... but today, I don't find any idea...

 

I have entries with specific associated strings and I want to compare those strings, position by position.

1             ABCDEF

2             ZBCDEF

3             ABXDEF

4             YBXDEF

5             AWCDEF

 

I succeeded for each position separately with a calculated dimension using the mid() function to extract the letter. I defined a variable vpos to dynamically select the position. It's ok for a pie chart.

Now, how to generate a bar chart showing the maximum frequency for all positions?

I started by creating a calculated dimension defining the different positions: ValueLoop($(vpos_min), $(vpos_max),1) to put on the x-axis. And... nothing, no idea!

 

Thanks a lot for your help.

Xavier

7 Replies
Kushal_Chawda

@XavierL  How you have calculated positions? What is expression? What is expected output?

XavierL
Contributor
Contributor
Author

To obtain this pie chart about a single position, I use the calculated dimension mid(string, $(vpos), 1) where vpos is the analysed position. The measure is count(ID).

XavierL_0-1601376442522.png

Now I woul like obtain a graph like this one :

XavierL_1-1601376571434.png

Thanks

XavierL
Contributor
Contributor
Author

Hi,

I revive my topic with a file, maybe easier to understand the question...

 

So, the pie chart provides the frequency of letters, position by position.

I would like a bar chart with the frequency of the most represented letter for each position.

=> the idea is to determine at a glance which positions vary the most.

 

Thanks a lot.

QFabian
Specialist III
Specialist III

Hi, just because they are few letters, i should try a word cloud visualization

QFabian
XavierL
Contributor
Contributor
Author

It's a simple example but you have to imagine the same with several hundred letters.

Thank you for your proposition.

GaryGiles
Specialist
Specialist

In your load script, create Positions table using the following

Positions:
Load RowNo() as Position
AutoGenerate 200;

Then, in your line chart, use Position for the x-Axis and count(distinct mid(string, Position, 1)).  Replacing string  with your string field.

marcus_sommer

I think I would try to do the most work within the script and not in the UI. This means to split the words into single letter within a field, for example with something like this:

load ID, Word, iterno() as IterNo, subfield(Word, iterno(), 1) as Letter
from Source while iterno() <= len(Word);

Afterwards you could simply count the letters und IterNo referenced to the positions of them.

- Marcus