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

Announcements
April 13–15 - Dare to Unleash a New Professional You at Qlik Connect 2026: Register Now!
cancel
Showing results for 
Search instead for 
Did you mean: 
smilingjohn
Specialist
Specialist

Formula

Hi All ,

Iam trying to take tow contents of the same field :Bat and ball" and trying to give it a name as branch  at the script level.

PLease someone suggest me which of the logic below is correct .

The Existing Code only for BAT is this

if(BRAND='BAT',mid(BRANCH,Index(BRANCH,'BAT')+3),BRANCH) AS BRANCH-NAME

now the requirement is to include the BALL also ,

Please sugegst me how do i do this Iam trying with below code

1. if(Match(BRAND,'BAT','BALL',mid(BRANCH,Index(BRANCH,'BAT','BALL'))+3),BRANCH)  AS BRANCH-BRANCHNAME,

2.if(BRAND='BAT',mid(BRANCH,Index(BRANCH,'BAT')+3),BRANCH)   AND

          if(BRAND='BALL',mid(BRANCH,Index(BRANCH,'BALL')+3),BRANCH) AS BRANCH-NAME

please someone suggest me how do i go about this .

Thanks in advance

1 Solution

Accepted Solutions
tresB
Champion III
Champion III

Try like:

if(Match(BRAND,'BAT','BALL'),mid(BRANCH,Index(BRANCH, BRAND)+3),BRANCH)  AS BRANCH-BRANCHNAME,

View solution in original post

5 Replies
avinashelite


could you please explain the actual requirement or the business the need ...so that we can suggest a better approach for the same

Not applicable

Do you want to know which is correct or how to go about this?

smilingjohn
Specialist
Specialist
Author

Actaully under BRANCH Name i want to have BAT and BALL with same formula ?

smilingjohn
Specialist
Specialist
Author

Actaully it was like only for BAT now the requirement is that we need to include BALL also in the BRANCH ?

For only BAT it was like this

if(BRAND='BAT',mid(BRANCH,Index(BRANCH,'BAT')+3),BRANCH) AS BRANCH.

tresB
Champion III
Champion III

Try like:

if(Match(BRAND,'BAT','BALL'),mid(BRANCH,Index(BRANCH, BRAND)+3),BRANCH)  AS BRANCH-BRANCHNAME,