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: 
Riccardo
Partner - Creator III
Partner - Creator III

Clustering / Aggregate a Count in a chart

Riccardo_0-1601635270926.png

Hello,

like the image, I have to do a count cluster:

# of Customer having a Sum(isVisit) = 1

# of Customer having a Sum(isVisit) = 2

# of Customer having a Sum(isVisit) >= 3

 

Do you know a best way to do it?

Thanks

 

Riccardo Schillaci
BI Analyst
Datawarehouse & Business Intelligence
Labels (1)
1 Solution

Accepted Solutions
Kushal_Chawda

@Riccardo  try below

Dimension:

=valuelist('1 Visit','2 Visit','3+ Visit')

Expression:

=Pick(match(valuelist('1 Visit','2 Visit','3+ Visit'),'1 Visit','2 Visit','3+ Visit'),

Count({<CustomerID ={"=sum(isVisit)=1"}>} distinct CustomerID),

Count({<CustomerID ={"=sum(isVisit)=2"}>} distinct CustomerID),

Count({<CustomerID ={"=sum(isVisit)>=3"}>} distinct CustomerID))

View solution in original post

5 Replies
Riccardo
Partner - Creator III
Partner - Creator III
Author

Trying this, it works. But I'm not sure that is the best way:

 

DIM

=if(aggr(sum(isVisita),Customer) = 1,'1',
if(aggr(sum(isVisita),Customer) = 2,'2',
if(aggr(sum(isVisita),Customer) >=3,'3+')))

 

Measure

sum(isVisita)

Riccardo Schillaci
BI Analyst
Datawarehouse & Business Intelligence
Kushal_Chawda

@Riccardo  try below

Dimension:

=valuelist('1 Visit','2 Visit','3+ Visit')

Expression:

=Pick(match(valuelist('1 Visit','2 Visit','3+ Visit'),'1 Visit','2 Visit','3+ Visit'),

Count({<CustomerID ={"=sum(isVisit)=1"}>} distinct CustomerID),

Count({<CustomerID ={"=sum(isVisit)=2"}>} distinct CustomerID),

Count({<CustomerID ={"=sum(isVisit)>=3"}>} distinct CustomerID))

Kushal_Chawda

@Riccardo  or below

Dimension:

=valuelist('1 Visit','2 Visit','3+ Visit')

Expression:

=Pick(match(valuelist('1 Visit','2 Visit','3+ Visit'),'1 Visit','2 Visit','3+ Visit'),

sum({<CustomerID ={"=sum(isVisit)=1"}>} isVisit),

sum({<CustomerID ={"=sum(isVisit)=2"}>} isVisit),

sum({<CustomerID ={"=sum(isVisit)>=3"}>} isVisit))

MMS118
Partner - Contributor
Partner - Contributor

Hi,

You can add a new dimension to your dashboard.

Perform the sum(isVisit) calculation on your load script as such.

TableName:

Load

AggregatingDimension,
IF(sum(isVisit)=1, 'isVisit=1', IF(sum(isVisit)=2, 'isVisit=2', 'isVisit=3')) as NewDimension

Resident OldTable
Group by AggregatingDimension;

Then you can simply have a bar chart with dimension = NewDimension and measure= count(Customer)

Riccardo
Partner - Creator III
Partner - Creator III
Author

Thank you. I'm using this solution, and it works fine.

 

Just a question. If I click the bar chart of "2 Visit", I would like to select (filter) the Custoemrs of cluster "2 Visit". How can I do that?

 

Thanks

Riccardo Schillaci
BI Analyst
Datawarehouse & Business Intelligence