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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Help with dimension in pivot table

Hi, guys,

I`m new to QlickView and could not find an answer to my question.

I`m crating a pivot table to categorize our clients by how many products they have

I`ve tried this in dimension but it doesn`t work

=If (Count(DISTINCT([productName]))>3, '4 products',

if (Count(DISTINCT([productName]))>2, '3  products',

if (Count(DISTINCT([productName]))>1, '2 products ', '1 product ')))

Any suggestions?

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hey, easy with the reload button...

Moving that to the script might be as easy as the following

LOAD

If (Count(DISTINCT([productName]))>3, '4 products',
if (Count(DISTINCT([productName]))>2, '3  products',
if (Count(DISTINCT([productName]))>1, '2 products ', '1 product '))) AS Dimension

RESIDENT OriginalTable

GROUP BY SalesPerson;

Obviously, field names and table names are just an example, use your own.

Hope that helps.

Miguel

View solution in original post

8 Replies
Miguel_Angel_Baeyens

Hi,

Yes, if any, the following should do

=Aggr(If (Count(DISTINCT([productName]))>3, '4 products',

if (Count(DISTINCT([productName]))>2, '3  products',

if (Count(DISTINCT([productName]))>1, '2 products ', '1 product '))), Dimension2)

Anyway, I'd strongly recommend you to move that logic to the script, because calculated dimensions may have severe impact in your dashboard performance.

Hope that helps.

Miguel

narender123
Specialist
Specialist

Have you tried this in Add calculated dimention or in expression.

Try it there.

Not applicable
Author

Thanks, Miguel,

and how to move that logic to script?

Not applicable
Author

Thanks, Miguel,

and how to move that logic to script?

Not applicable
Author

Thanks, Miguel,

and how to move that logic to script?

Miguel_Angel_Baeyens

Hey, easy with the reload button...

Moving that to the script might be as easy as the following

LOAD

If (Count(DISTINCT([productName]))>3, '4 products',
if (Count(DISTINCT([productName]))>2, '3  products',
if (Count(DISTINCT([productName]))>1, '2 products ', '1 product '))) AS Dimension

RESIDENT OriginalTable

GROUP BY SalesPerson;

Obviously, field names and table names are just an example, use your own.

Hope that helps.

Miguel

Not applicable
Author

Hey, Miguel,

One more question, I`ve loaded my data form txt file, where can i find the name of my table?

Miguel_Angel_Baeyens

Hi,

Use the Table Viewer or Control + T when the document is open in the QlikView Desktop and you will see there your tables.

For what it's worth, get used to name your tables always in the load script, as follows:

Customers: // this is the table name

LOAD *

FROM Customers.qvd (qvd);

Hope that helps.

Miguel