Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
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.
if(Wildmatch(GetFieldSelections(customer),'*Customer A','*Customer A*', 'Customer A*') OR ISNULL(GetFieldSelections(customer)),'Included','Excluded')
😍
Thx
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')
Yes, this is the better solution. Thx
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