Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Customers, Partners & Luminaries only: You're invited to a Data Analytics Roadmap session. Read More
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor III
Contributor III

aggr condition in bar chart

Hi,

I have a issue in bar chart using aggr function when calculate the no. of vendors for each part and company_site

The dimension is:

=if(aggr(Count(DISTINCT Vendor_Code), Part_Code,Company_Site)=1,

'1 Vendor',

aggr(Count(DISTINCT Vendor_Code), Part_Code,Company_Site)&' Vendors')

And the expression is:

Count(DISTINCT Part_Code)

So the bar chart is below, and link to category detail table. Now the Company Site and Part Number column is not selected

1.png

The issue is when click the 2 Vendors in bar chart, 1 Vendor has appeared. Normally, this should not appear.

2.png

Owing to the third record, Company Site and Part Number has only one Vendor.

The first and second record is what I want when I click the bar chart.

Can anybody help me to fix this issue? Thanks.

1 Solution

Accepted Solutions
Highlighted

Create a new field in the script using this

LOAD AutoNumber(Part_Code&Company_Site) as Key,


and then try this as your dimension

=If(Aggr(Count(DISTINCT Vendor_Code), Key) = 1, '1 Vendor', Aggr(Count(DISTINCT Vendor_Code), Key)&' Vendors')

View solution in original post

5 Replies
Highlighted

Create a new field in the script using this

LOAD AutoNumber(Part_Code&Company_Site) as Key,


and then try this as your dimension

=If(Aggr(Count(DISTINCT Vendor_Code), Key) = 1, '1 Vendor', Aggr(Count(DISTINCT Vendor_Code), Key)&' Vendors')

View solution in original post

Highlighted
Contributor III
Contributor III

Thank Sunny, the Part_Code and Company_Site is in different table, I will try to modify the data model.

Highlighted

It might be possible without changing the data model, but it will have to be tested, would you be able to share a sample?

Highlighted
Contributor III
Contributor III

I have create a demo.qvw, but the issue is it appear 3 Vendors when click the 1 Vendor

Highlighted
Contributor III
Contributor III

I have change the data model, and it working well, Thank you again.