Qlik Community

QlikView Deployment

Discussion Board for collaboration related to QlikView Deployment.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

kevbrown
Contributor II

Anonymise customers

Hi,

I've just looking at a PoC at the moment and was wondering if there's a way to produce a graph, based on customer sales for example but the labels for customers will show the customer selected and then for the rest of the customers state, "customer 1, customer 2, customer 3" and so on.  Obviously when the customer selection is changed, that customer label is then visible and everything else is labelled as before, customer 1 etc

Thanks

Kev

1 Solution

Accepted Solutions
MVP
MVP

Re: Anonymise customers

OK, this is closer to your original request:

If you define the customers as a dual like this:

LOAD Dual(Customer, RowNo()) As Customer,

  Value

;

LOAD * Inline

[

  Customer, Value

     ....

(You can use Rowno() like this or Autonumber() to get a distinct number for each customer)

Then you could use this expression:

=If(Index(GetFieldSelections(Customer, '|'), Customer), Customer, Dual('Other', Num(Customer)))

And the non-selected customers will be one line per customer, all labelled 'Other'. The value of the dual is used for the dimension, and they all have different values in spite of the same label.

Capture.PNG

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
9 Replies
MVP
MVP

Re: Anonymise customers

Could you explain a bit more may be with a sample data set?

miguelbraga
Valued Contributor III

Re: Anonymise customers

Hey there,

Not sure you what you want, but try add these 4 expressions in you table:

For customer selected:

=Sum{Sales)

For customer 1:

=Sum{{$<Customer = ['customer 1'>} Sales)

For customer 2:

=Sum{{$<Customer = ['customer 2'>} Sales)

For customer 3:

=Sum{{$<Customer = ['customer 3'>} Sales)

Best regards,

D.A. MB

PS: if this doesn't solve your problem give us a better explanation and exemplify with sample of your data and the expected output.

Re: Anonymise customers

I am not sure your intend, But as i understand you can use this

Aggr(Sum(Sales), Customers)

Life is so rich, and we need to respect to the life !!!
sergio0592
Valued Contributor II

Re: Anonymise customers

Maybe something like that:

=if(Customer =getfieldselections(Customer), Customer, 'Customer'&RowNo())

MVP
MVP

Re: Anonymise customers

You could probably do this with a calculated dimension. I got this far:


=If(Index(GetFieldSelections(Customer, '|'), Customer), Customer, 'Other Customers')

So this will show the selected customers by name, and group the rest in 'Other Customers'. I have not been able to figure out a simple way in the front end to show the others with individualized names.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
MVP
MVP

Re: Anonymise customers

OK, this is closer to your original request:

If you define the customers as a dual like this:

LOAD Dual(Customer, RowNo()) As Customer,

  Value

;

LOAD * Inline

[

  Customer, Value

     ....

(You can use Rowno() like this or Autonumber() to get a distinct number for each customer)

Then you could use this expression:

=If(Index(GetFieldSelections(Customer, '|'), Customer), Customer, Dual('Other', Num(Customer)))

And the non-selected customers will be one line per customer, all labelled 'Other'. The value of the dual is used for the dimension, and they all have different values in spite of the same label.

Capture.PNG

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
effinty2112
Honored Contributor

Re: Anonymise customers

Hi Kevin,    

               Add a listbox with field Customer and assign it to an alternate state such as PickCustomer, then try this calculated dimension:

=Aggr(if(Customer=only({PickCustomer}Customer),Customer, 'Customer ' & FieldIndex('Customer',Customer)), Customer)

Kind regards

Andrew

Re: Anonymise customers

May be it can be even done like this without alternate state

=Aggr(if(Only({<Customer>}Customer) = Customer,Customer, 'Customer ' & FieldIndex('Customer',Customer)), Customer)

MVP
MVP

Re: Anonymise customers

Picking up a tip from Sunny's suggestion - no need to load Customer as a dual, use this instead:

=If(Index(GetFieldSelections(Customer, '|'), Customer), Customer, Dual('Other', FieldIndex('Customer',Customer)))

Capture.PNG

Capture.PNG

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein