Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
kevbrown
Creator II
Creator 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
jonathandienst
Partner - Champion III
Partner - Champion III

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

View solution in original post

9 Replies
tresesco
MVP
MVP

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

miguelbraga
Partner - Specialist III
Partner - Specialist III

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.

Anil_Babu_Samineni

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

Aggr(Sum(Sales), Customers)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sergio0592
Specialist III
Specialist III

Maybe something like that:

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

jonathandienst
Partner - Champion III
Partner - Champion III

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
jonathandienst
Partner - Champion III
Partner - Champion III

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
Master
Master

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

sunny_talwar

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

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

jonathandienst
Partner - Champion III
Partner - Champion III

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