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: 
qliklizzy
Creator II
Creator II

if statement in expression using a calculated dimension

hi

I have this dimension calculation which just groups two specialties together:

=if(CurrentSpec='ENDOC' or CurrentSpec='DIAB','DIAB/ENDOC',CurrentSpec)

then in an expression I need to allocate a number of beds to the specialty:

but it is not recognising my calculated dimension so i added the calucation back in but it still wont alocated a number to thtat combined specialty.

(i did have if(CurrentSpec='ENDOC' or 'DIAB','21',  but this also didnt work)

if(if(CurrentSpec='ENDOC' or CurrentSpec='DIAB','DIAB/ENDOC',CurrentSpec)='DAIB/ENDCO','21',

if(CurrentSpec='CARD','18',
if(CurrentSpec='ELM','52',
if(CurrentSpec='GASTRO','28',
if(CurrentSpec='RESPMED','26',0)))))

is there a way of doing this other than maybe combining the speicalties in the script; but its always good to see them seperate in the raw data.

thanks for you help

10 Replies
sunny_talwar

May be like this

Dimension

=if(Match(CurrentSpec, 'ENDOC', 'DIAB'), 'DIAB/ENDOC',CurrentSpec)

Expression

if(Match(CurrentSpec, 'ENDOC', 'DIAB'), 21,

if(CurrentSpec='CARD', 18,
if(CurrentSpec='ELM', 52,
if(CurrentSpec='GASTRO', 28,
if(CurrentSpec='RESPMED', 26, 0)))))

sunny_talwar

Or this as your expression

Pick(Match(CurrentSpec,  'ENDOC', 'DIAB', 'CARD', 'ELM', 'GASTRO', 'RESPMED') + 1, 0, 21, 21, 18, 52, 28, 26)

qliklizzy
Creator II
Creator II
Author

thanks tried this and its still not populating for it.

i see you have posted again i will try that now

thank you

qliklizzy
Creator II
Creator II
Author

no just for that combined specialty it doesnt allocate it.

how bizarre

thanks for trying i have learned a new expression 'pick'

sunny_talwar

Would you be able to share a sample where this isn't working for you?

qliklizzy
Creator II
Creator II
Author

I have just scambled all the data, as its identifiable to patients. - i had to detele evertthing else in the app to make sure i could send the size over.

thanks

sunny_talwar

Do you have section access? I am unable to open the file

qliklizzy
Creator II
Creator II
Author

sorry i dont know what that means?

sunny_talwar

Its a type of security. You can read about it here:

Introduction to Section Access