Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
mambi
Creator III
Creator III

fields comparison

Hi everyone,

from the exemple below i want to know if the product price had changed over years and display the result ( changed or unchanged ) in the COMP column

the number of years is more important so i don't want to use many nested if

Pord

YEAR 1

YEAR 2

YEAR 3

YEAR 4

COMP

A

12

13

14

15

B

12

12

12

12

C

14

14

14

15

any idea ?

1 Solution

Accepted Solutions
MarcoWedel

Hi Mambi,

tabInput:

CrossTable (year, [product price], 1)

LOAD * FROM [http://community.qlik.com/thread/114194]

(html, codepage is 1252, embedded labels, table is @1);

tabChanged:

LOAD

  Pord,

  if(Count(DISTINCT [product price])>1, 'changed', 'unchanged') as COMP

Resident tabInput

Group By Pord;

QlikCommunity_Thread_114194_Pic1.JPG.jpg

hope this helps

regards

Marco

View solution in original post

4 Replies
MarcoWedel

Hi Mambi,

tabInput:

CrossTable (year, [product price], 1)

LOAD * FROM [http://community.qlik.com/thread/114194]

(html, codepage is 1252, embedded labels, table is @1);

tabChanged:

LOAD

  Pord,

  if(Count(DISTINCT [product price])>1, 'changed', 'unchanged') as COMP

Resident tabInput

Group By Pord;

QlikCommunity_Thread_114194_Pic1.JPG.jpg

hope this helps

regards

Marco

Not applicable

Don't know how to avoid using if. Just try to use less if.

How about compare individual number with the average number? but you still need 4 if...it's not good enough I think.

Not applicable

Mambi,

you may also like something more dynamic, with year selection possibility and check change for selected years.

I used Marco sample and added some chart.

Regards

Darek

ToniKautto
Employee
Employee

I agree with Marco's solution.

In this scenario the key is to make the data model handle the year as a field, so that you can apply selections and aggregation by year. From the structure of your incoming data the Crosstable() function will help rotate the data in to the preferred order.