Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

sundarakumar
Valued Contributor II

Expression help

Hi All,

Below is the sample data set, I want to create a straight table as shown in output.

Requirement: the country name which made the max sale for every year.

CountrysalesYear
a1002010
b2002010
c 3002010
d4002010
a8002011
b6002011
c 7002011
d5002011
a1002010
b2002010
c 3002010
d4002010
a8002011
b6002011
c 7002011
d5002011

output:

yearcountrysales
2010d800
2011a1600

Thanks in advance

Regards,

Sundar

1 Solution

Accepted Solutions
anbu1984
Honored Contributor III

Re: Expression help

11 Replies
MVP
MVP

Re: Expression help

It is very straight forward:

1. Create a Straight Table

2. Add Year as dimension

3. Add Only(Country) as expression

4. Add Max(sales) as expression

DONE ...

sundarakumar
Valued Contributor II

Re: Expression help

Thanks for the reply,

Attached the sample app, can you please help me with what am misssing?

Regards,

Sundar

Highlighted
anbu1984
Honored Contributor III

Re: Expression help

Check this app

Dim: Year, Country

Expr: If(Sum(sales)=Max( TOTAL<Year> Aggr(Sum(sales),Country,Year)),Sum(sales))

sundarakumar
Valued Contributor II

Re: Expression help

Thank you,

this is working as expected, but y is this not working in a pivot table?

Regards,

Sundar

anbu1984
Honored Contributor III

Re: Expression help

Set this property, then pivot will display data

Chart Properties --> Presentation --> Check "Always fully expanded"

Employee
Employee

Re: Expression help

Why do you want to move it to a pivot table? Your initial questions seems very well suited for a straight table presentation.

Please attach an example of what your pivot table looks like, so we can understand how you have done the pivot table.

sundarakumar
Valued Contributor II

Re: Expression help

Hi Toni,

The sample that I have posted above has just 2 dimensions, but in actual scenario there are three, I was hoping that i can replicate the result for three dimensions once i get an idea here

If(Sum(sales)=Max( TOTAL<dim1,dim2> Aggr(Sum(sales),dim1,dim2,dim3)),Sum(sales))

I was trying to get one dimension horizontal and another vertical so wanted to switch over to Pivot.

Please find attached the sampe excel with the expected output.

Thanks in advance.

Regards,

sundar

sundarakumar
Valued Contributor II

Re: Expression help

Anbu,

Thanks for the reply, Attached the sample data and output required. Sorry for the trouble i thought i will be able to replicate the sample to my scenario

Thanks again

Regards,

Sundar

anbu1984
Honored Contributor III

Re: Expression help