If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.
Hi,
I need help creating a dynamic title for my chart visualization. I have a bar chart that uses a drill down dimension that goes from the provincial level to region level to facility level. Ideally, I would like my title to say: "Total Cases by Province/Region/Facility". For example, at the provincial level, I would like my title to say "Total Cases by Province" and once the user clicks on a province to drill down to regions, I would like my title to change to "Total Cases by Region". How can I achieve this?
I experimented using the GetSelectedCount expression:
=If(GetSelectedCount(facility_province)=0,Text('Total Cases by Province'),
If(GetSelectedCount(facility_province), Text('Total Cases by Region'),
If(GetSelectedCount(facility_region), Text('Total Cases by Facility')))))
However, once reached to the region level, when I click on a region to display cases by facility, the title does not change to "Total Cases by Facility". Is there something wrong with the expression or is there a better way to achieve this?
Thanks in advance!
can u try like
"Total Cases by "&GetFieldSelections(field)
Thanks for the reply!
How do I make it so that the most recent selection is displayed in the title?
For example, I have a drill down dimension that uses province, region, and facility. The expression that I have used for the title is: ='Total Cases by' & GetFieldSelections(facility_province, facility_region, org_name)
Since this is a drill down dimension, when i select a province and then a region, the title still says 'Total Cases by Province' rather than 'Total Cases by Region'. It doesn't display the title based on the most current selection. How can I fix this?
Try something like this may be -
=If(GetSelectedCount(facility_province)=0,Text('Total Cases by facility_province'),
If(GetSelectedCount(facility_region)=0, Text('Total Cases by facility_region'),
If(GetSelectedCount(Facility)=0, Text('Total Cases by Facility'))))
HI,
Try below expression
=if(GetSelectedCount(facility_province)>0 and GetSelectedCount(facility_region)>0 and GetSelectedCount(facility_facility)>0,'Total Cases by Facility',
if(GetSelectedCount(facility_province)>0 and GetSelectedCount(facility_region)>0,'Total Cases by Facility',
if(GetSelectedCount(facility_province)>0,'Total Cases by Region', 'Total Cases by Province')))
Thanks,
Sasi
Thanks for the reply!
This seems to be working, however, I have two visualizations (bar chart and map) that uses this dynamic title. The fields used to create both of the drill down dimensions are different. The bar chart uses the fields, facility_province, facility_region, and org_name while the drill down dimension for the map uses the fields containing the geography. Therefore when writing the expression I tried using an OR clause to represent if either field is selected display [blank] title. This is my expression:
=if(GetSelectedCount(facility_province)>0 OR GetSelectedCount([provinces.Area])>0 and GetSelectedCount(facility_region)>0 OR GetSelectedCount([region.Area])>0 and GetSelectedCount(org_name)>0 OR GetSelectedCount(org_LONG_org_LAT)>0,[org_name],
if(GetSelectedCount(facility_province)>0 OR GetSelectedCount([provinces.Area])>0 and GetSelectedCount(facility_region)>0 OR GetSelectedCount([region.Area])>0, facility_region,
if(GetSelectedCount(facility_province)>0 OR GetSelectedCount([provinces.Area])>0, facility_province, 'Canada')))
I keep getting an error. How do I fix this?
HI Nira,
I really couldn't understand ?? why do you want to use OR clause ??
is this related to dynamic tittle or calculated Dimension ??
Can you explain a bit more
This is related to creating a dynamic title for visualizations that use drill down dimension. The reason why I have used an OR clause is because when users click on a feature from the facility_province field or provinces.Area field, I want the title to say the same thing "Total Cases by Province". Similar to if users click on a feature from the facility_region field or region.Area field, I want the title to say "Total Cases by Region".
One is the dimension field used for the bar chart (eg. facility_province, facility_region) and one is the geography field used for the map chart (eg. provinces.Area, region.Area). I want the dynamic title to be responsive to both charts hence the OR clause.
thanks for the clarification,
try below expression,
=If(
(GetSelectedCount(facility_province)>0 OR GetSelectedCount([provinces.Area])>0 ) and (GetSelectedCount(facility_region)>0 OR GetSelectedCount([region.Area])>0 ) and (GetSelectedCount(org_name)>0 OR GetSelectedCount(org_LONG_org_LAT)>0), 'Total Cases by Organization',
if(
(GetSelectedCount(facility_province)>0 OR GetSelectedCount([provinces.Area])>0) and (GetSelectedCount(facility_region)>0 OR GetSelectedCount([region.Area])>0), ' Total Cases by Organization',
if(
(GetSelectedCount(facility_province)>0 OR GetSelectedCount([provinces.Area])>0),
'Total cases by Region', 'Total cases by province'
)
)
)