Qlik Community

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
QlikWorld online is next week! REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Evan0211
Creator
Creator

If statement with multiple match clauses and chart filtering

I have a KPI that has an expression written as such:

 

=if(
Match([OFFICE_CODE], $(vFilterOfficeCode))
and
Match([List Title], $(vItemsToShow))
,

Avg([SA Initial to Completed Days]),'error')

For a pie chart control, I have the following expression:

=Count({
<[OFFICE_CODE] = {$(vFilterOfficeCode)}>
*
<[List Title] = {$(vItemsToShow)}>

} [Title])

 

When I select one slice of the pie chart, everything filters and the average is calculated, but if I select more than one slice of the pie chart, I receive the 'error' section of my if statement but I have no idea why.  The slices are using the same variable as the KPI if statement but if I select more than one slice, it fails.  Any ideas?

1 Solution

Accepted Solutions
Joseph_Musekura
Support
Support

Hi @Evan0211 ,

Can you check what  Match() is returning when you select more than 1 slice? 
1.  create a KPI using Match([OFFICE_CODE], $(vFilterOfficeCode))

2. add a filter pane using  [OFFICE_CODE]

3. Select 1 code in filter pane, then 2 codes. check the result (behavior) of KPI  => this will show why the if statement is failing

you can use a table as well and compare the result of your selections

Regards

View solution in original post

2 Replies
Or
Master III
Master III

Hard to say without knowing what's behind those variables. Best guess is at least one of them contains an expression that won't work correctly if you select multiple values in whatever dimension the pie chart is using. Another alternative is that your KPI expression doesn't return a single value in this scenario, and since it's not wrapped in an aggregation function, that would cause it to null out.

Joseph_Musekura
Support
Support

Hi @Evan0211 ,

Can you check what  Match() is returning when you select more than 1 slice? 
1.  create a KPI using Match([OFFICE_CODE], $(vFilterOfficeCode))

2. add a filter pane using  [OFFICE_CODE]

3. Select 1 code in filter pane, then 2 codes. check the result (behavior) of KPI  => this will show why the if statement is failing

you can use a table as well and compare the result of your selections

Regards