Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Zeta
Contributor III
Contributor III

Text note, if Sales of customer A are included in the sum of sales

Hello Qlik Community,

maybe someone has a solution for the following problem:
It is a customer dimension with customers A, B, C, D.
It is a KPI that sums up the sales of the customers.
Whenever customer A's sales are included in the sum of the KPI, text should appear in a chart (text chart best alternative?) indicating that customer A's sales are included in the sum.
If no selection was made in the customer dimension, then the sales of customer A are included in the total because all customers are consolidated.
If customers A and B are selected, the sales from customer A are included in the total.
Only if customer A is explicitly excluded should the note not appear.

How to solve this problem with a chart function?
I look forward to help.
Thanks in advance.

Best regards

Labels (3)
1 Solution

Accepted Solutions
Zeta
Contributor III
Contributor III
Author

Hello @E_Røse 

I changed your function slightly. Without the first condition

GetSelectedCount(Customer)>0

I get the same result, so I left out this part. In the second condition, I swapped the 1 for a $. This allows me to use other filters, since the formula then only searches over the remaining, selectable elements of the Customer dimension.

if(not match('A', $(=concat( distinct {$<Customer=$::Customer>} chr(39) & Customer ,chr(39) &',') & chr(39))), 'not included', 'included')

Thanks again for your help. I would never have come up with the solution myself

View solution in original post

6 Replies
Zeta
Contributor III
Contributor III
Author

No!

If, no selections are made in the Customer field, then there should be a warning, because the sales of the customer A are included.

ogster1974
Partner - Master II
Partner - Master II

if(Wildmatch(GetFieldSelections(customer),'*Customer A','*Customer A*', 'Customer A*') OR ISNULL(GetFieldSelections(customer)),'Included','Excluded')

 

Zeta
Contributor III
Contributor III
Author

😍

Thx

E_Røse
Creator II
Creator II

@Zeta 

Get FieldSelection does not always return a list of the selected values. Wouldn't that cause some problems, e.g if you choose all values but A?

This should also work:

if(GetSelectedCount(Customer)>0
and not match('A', $(=concat( distinct {1<Customer=$::Customer>} chr(39) & Customer ,chr(39) &',') & chr(39))), 'not included', 'included')

Zeta
Contributor III
Contributor III
Author

Yes, this is the better solution. Thx

Zeta
Contributor III
Contributor III
Author

Hello @E_Røse 

I changed your function slightly. Without the first condition

GetSelectedCount(Customer)>0

I get the same result, so I left out this part. In the second condition, I swapped the 1 for a $. This allows me to use other filters, since the formula then only searches over the remaining, selectable elements of the Customer dimension.

if(not match('A', $(=concat( distinct {$<Customer=$::Customer>} chr(39) & Customer ,chr(39) &',') & chr(39))), 'not included', 'included')

Thanks again for your help. I would never have come up with the solution myself