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

Shorten Dimension Name In Bar Chart

Dear Community,

I have a dimension which has a length of around 150 characters.

Instead of using the complete name in the dimension label for each bar, I want to be able to use a substring (the first substring or the last substring) in the label for  Dimension in the chart visualization.

For Example, if the deptname is ADFDFDDFDDFQQ4GR44DFFDFDFEGBJNUDFDFDNIONIN/ADFDFDFI/ADFDADFEBRR7FDFD/DADFWRVDFD, i want the chart to only display (say) its last substring which is 'DADFWRVDFD' and so on for every bar in the dimension.

Is there anything we can do using aggregate function for the dimension label for the chart or something like that?

Please find the sample attached.

Regards,

-Khaled.

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Use subfield(DeptName,'/',-1) to get the last substring or subfield(DeptName,'/',1) to get the first substring.


talk is cheap, supply exceeds demand

View solution in original post

7 Replies
khadeer
Specialist
Specialist

Hi   PFA

khadeer
Specialist
Specialist

just write in calculated dimension as

subfield(ur fieldname,'/',1)

it gives first part of the string,

subfield(ur fieldname,'/',-1)

for last substring

same u can change number which part u want.

neha_shirsath
Specialist
Specialist

Hi,

ADFDFDDFDDFQQ4GR44DFFDFDFEGBJNUDFDFDNIONIN/ADFDFDFI/ADFDADFEBRR7FDFD/DADFWRVDFD

if u want to diplay above dept NAME ,start string eg- ADFD it can be done in Presentation tab> Legend> mark on Show legend-Dept NAME & then mark on Limit Legend(Characters) as 4 then you will get the ADFD.

Gysbert_Wassenaar

Use subfield(DeptName,'/',-1) to get the last substring or subfield(DeptName,'/',1) to get the first substring.


talk is cheap, supply exceeds demand
Not applicable
Author

Hi,

Thank you for your response.

I cannot use this since the length of the string to extract for name is not of fixed length.

Regards,

-Khaled.

Not applicable
Author

Gysbert,

I used something like:

=SubField(Level1Desc,'/',(SubStringCount(Level1Desc,'/')+1)) and it works fine where +1 is to get the index of the delimiter ('/') for the first string esp. when the substring count is varying.

Thank you for your response.

Regards,

-Khaled.

Not applicable
Author

Thank you,

I noticed I could just mark only one answer as correct.

Many thanks for all your effort.

Regards,

-Khaled.