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: 
kev6brown
Partner - Creator II
Partner - Creator II

Gauge

I'm looking to create a gauge that works differently depending on what has been selected from the calendar.

so, if [CalMonth] is selected the calculation needs to be

Count((BedDaysPatientID))
/
((Sum({<CalDay={1}>}Data)/2)*Count(CalDay))

if [CalDay] is selected the calculation will be

Count(Distinct(BedDaysPatientID))
/
((Sum(Data)/2)*Count(CalDay))

How do i write the calculation based on the above?

Thanks

Kev

1 Solution

Accepted Solutions
vmoreno2605
Creator
Creator

sorry, i missed the last ")"

 

if(GetSelectedCount(CalDay)>0,Count(Distinct(BedDaysPatientID))/((Sum(Data)/2)*Count(CalDay)),

if(GetSelectedCount(CalMonth)>0,Count((BedDaysPatientID))/((Sum({<CalDay={1}>}Data)/2)*Count(CalDay))

) )

View solution in original post

7 Replies
vmoreno2605
Creator
Creator

if(GetSelectedCount(CalDay)>0,Count(Distinct(BedDaysPatientID))/((Sum(Data)/2)*Count(CalDay)),

if(GetSelectedCount(CalMonth)>0,Count((BedDaysPatientID))/((Sum({<CalDay={1}>}Data)/2)*Count(CalDay))

)

What will happen is when you select callmonth and callday it's gonna use callday calculation.

 

I hope this works

vmoreno2605
Creator
Creator

sorry, i missed the last ")"

 

if(GetSelectedCount(CalDay)>0,Count(Distinct(BedDaysPatientID))/((Sum(Data)/2)*Count(CalDay)),

if(GetSelectedCount(CalMonth)>0,Count((BedDaysPatientID))/((Sum({<CalDay={1}>}Data)/2)*Count(CalDay))

) )

kev6brown
Partner - Creator II
Partner - Creator II
Author

Superb, works perfectly, if I then want to add [CalYear]  as a third layer?

vmoreno2605
Creator
Creator

you just need to add another if like this:

 

if(GetSelectedCount(CalDay)>0,Count(Distinct(BedDaysPatientID))/((Sum(Data)/2)*Count(CalDay)),

if(GetSelectedCount(CalMonth)>0,Count((BedDaysPatientID))/((Sum({<CalDay={1}>}Data)/2)*Count(CalDay)),

if(GetSelectedCount(CalYear)>0,/*YOUR CODE HERE*/

) ))

kev6brown
Partner - Creator II
Partner - Creator II
Author

That's what I assumed but it didn't work. I'll take another look. thank you

kev6brown
Partner - Creator II
Partner - Creator II
Author

So, this work brilliantly -

if(GetSelectedCount(CalDay)>0,Count ({<WardCode={'Grattan'}>}Distinct(BedDaysPatientID)),
if(GetSelectedCount(CalMonth)>0,Count({<WardCode={'Grattan'}>}(BedDaysPatientID))))

However when I try to add CalYear

if(GetSelectedCount(CalDay)>0,Count ({<WardCode={'Grattan'}>}Distinct(BedDaysPatientID)),
if(GetSelectedCount(CalMonth)>0,Count({<WardCode={'Grattan'}>}(BedDaysPatientID))),
if(GetSelectedCount(CalYear)>0,Count({<WardCode={'Grattan'}>}(BedDaysPatientID))))

It doesn't work and I get an error in expression: If takes 2-3 parameters

vmoreno2605
Creator
Creator

Try it like this

if(GetSelectedCount(CalDay)>0,Count ({<WardCode={'Grattan'}>}Distinct(BedDaysPatientID)),
if(GetSelectedCount(CalMonth)>0,Count({<WardCode={'Grattan'}>}(BedDaysPatientID)), /*Only two ')', */
if(GetSelectedCount(CalYear)>0,Count({<WardCode={'Grattan'}>}(BedDaysPatientID)))))