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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
kev6brown
Partner - Creator II
Partner - Creator II

Calculatio

If i break the following calculation in 6 seperate calculations they work find however in the form below (as i need it to be) it has an error - Garbage after expression:','

What am I doing wrong?

if(GetSelectedCount(CalDay)>0,(Count ({<WardCode={'Grattan'}>}Distinct(BedDaysPatientID)))*2
-
if(GetSelectedCount(CalDay)>0,Count ({<WardCode={'Grattan'},Leave={'Y'}>}Distinct(BedDaysPatientID))))
/
if(GetSelectedCount(CalDay)>0,(Sum({<WardCode={'Grattan'}>}Data))*Count(CalDay))
,
if(GetSelectedCount(CalMonth)>0,(Count({<WardCode={'Grattan'}>}(BedDaysPatientID)))*2)
-
if(GetSelectedCount(CalMonth)>0,(Count({<WardCode={'Grattan'},Leave={'Y'}>}(BedDaysPatientID)))*2)
/
if(GetSelectedCount(CalMonth)>0,(Sum({<CalDay={1},WardCode={'Grattan'}>}Data))*Count(CalDay))

2 Solutions

Accepted Solutions
lockematthewp
Creator II
Creator II

It looks like you need to remove one of the closing brackets before the comma. All of your parenthesis are closed before the comma but after the comma is your else statement.

View solution in original post

neelamsaroha157
Specialist II
Specialist II

You may Try this - (check brackets)

if(GetSelectedCount(CalDay)>0,

(Count ({<WardCode={'Grattan'}>}Distinct BedDaysPatientID)*2
-
Count ({<WardCode={'Grattan'},Leave={'Y'}>}Distinct BedDaysPatientID))
/
Sum({<WardCode={'Grattan'}>}Data))*Count(CalDay)
,
if(GetSelectedCount(CalMonth)>0,

(Count({<WardCode={'Grattan'}>}BedDaysPatientID)*2
-
Count({<WardCode={'Grattan'},Leave={'Y'}>} BedDaysPatientID)*2)
/
Sum({<CalDay={1},WardCode={'Grattan'}>}Data))*Count(CalDay)

View solution in original post

2 Replies
lockematthewp
Creator II
Creator II

It looks like you need to remove one of the closing brackets before the comma. All of your parenthesis are closed before the comma but after the comma is your else statement.

neelamsaroha157
Specialist II
Specialist II

You may Try this - (check brackets)

if(GetSelectedCount(CalDay)>0,

(Count ({<WardCode={'Grattan'}>}Distinct BedDaysPatientID)*2
-
Count ({<WardCode={'Grattan'},Leave={'Y'}>}Distinct BedDaysPatientID))
/
Sum({<WardCode={'Grattan'}>}Data))*Count(CalDay)
,
if(GetSelectedCount(CalMonth)>0,

(Count({<WardCode={'Grattan'}>}BedDaysPatientID)*2
-
Count({<WardCode={'Grattan'},Leave={'Y'}>} BedDaysPatientID)*2)
/
Sum({<CalDay={1},WardCode={'Grattan'}>}Data))*Count(CalDay)