Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Function aggr and function max

Hi all,

In an input file I have sales data:

Year (Year), Id Sale (IdSales), Id Customer (IdCustomer) and  Id Country (IdCountry).

I want to analyze how many customers have 1 sales 2 sales across the country ....

I used a pivot table with IdCountry as dimension  and expression  as:

Count (if (aggr (count (IdSales) IdCountry, IdCustomer) = 2, IdCustomer))

to count how many customers have, for example, 3 sales.

How can I do to make sure that the table refers, without any active selection, the maximum value of the year (in my case 2011).

Thank All

1 Reply
Not applicable
Author

Regarding my previous question, I changed the table and i created a pivot table in which the dimensions are:

1-a calculate dimension:

=aggr(Count(IdSales),IdCountry,IdCustomer)

2-Another dimension:    IdCountry

I have an expression like:

     Count(distinct IdCustomer)

To make the table con the maximum value of the year, I modified the calcutated dimension like:

=aggr((Count({$ <Year={$(=Max(Year))}>}   IdSales )),IdCountry,IdCustomer)

But it does not work.

Can anyone give me some help?