Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

comparison issue

hi all,

i have products say bost,horlicks,rose milk with prices respectively.

when i pull product as dimension and

expression1:

sum(price)

expression2:

sum(price)*10

expression3:

if((sum(pricek)=sum(pricek1)),'Y','N')

the result of expression3 displays 'Y' .

why is it happening this way; actually it should display 'N' right?

PFA if needed clarification.

hic

1 Solution

Accepted Solutions
sunny_talwar

I think the reason is related to the use of aggregation over the column label (or column() function). AFAIK, you cannot use aggregation functions such as Sum, Avg, Count, etc... over the column labels.

View solution in original post

7 Replies
sunny_talwar

Try this instead:

If(pricek = pricek1, 'Y', 'N')

sunny_talwar

Sum(pricek) was giving 0 and so was Sum(pricek1) and that is why the equality was holding true:

Capture.PNG

Not applicable
Author

yea, what can be the reason behind it?

sunny_talwar

I think the reason is related to the use of aggregation over the column label (or column() function). AFAIK, you cannot use aggregation functions such as Sum, Avg, Count, etc... over the column labels.

Not applicable
Author

Even if i use fields name like:

if((sum(price)=sum(price)),'Y','N')

also it shows 'Y ---> which wrong

i am thinking what can be the exact reason behind this

sunny_talwar

Why is Sum(price) = Sum(price) giving you Y wrong? They are the exact same thing and should equal.

Have you tried this?

If(Sum(price) = Sum(price) * 10, 'Y', 'N')

Not applicable
Author

ho its my mistake.thank you