Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Loreen
Contributor III
Contributor III

Problem with Sign function

Hi everybody,

I create 2 calculated dimensions =Sign(Aggr(Sum(%PNV),[OrderPost_id])) and =if(Sign(Aggr(Sum(%RBC),[OrderPost_id]))<>1,'Negative RBC','Positive RBC').  

The calculated dimension with RBC works for all the data except when the PNV is negative, it gives me this :

RBC-.png

I don't understand why there's a '1' for negative numbers with PNV calculated dimension. Besides, as you can see, it shows 'Negative RBC' for only 2 rows but not for the others with RBC calculated dimension.

Do you have an idea of what could be the reason of it ?

Thanks in advance

Regards 

Loreen

6 Replies
pradosh_thakur
Master II
Master II

=Sign(Aggr(Sum(%PNV),[OrderPost_id])) 

 

 =if(Sign(Aggr(Sum(%RBC),[OrderPost_id]))<>1,'Negative RBC','Positive RBC').  

 

I dont think %PNV and %RBC are same . Are they ?

Learning never stops.
pradosh_thakur
Master II
Master II

May be try using fabs() and see if you encounter the problem or not.
Learning never stops.
marcus_sommer

Maybe the context of your calculation is wrong - means you might need a different and/or further dimensions within the aggr().

- Marcus

 

sunny_talwar

What is PNV column here a calculated dimension? a dimension? or a measure? If it is not a straight field... can you share the expression behind it?

Loreen
Contributor III
Contributor III
Author

No, PNV and RBC are different measures
Loreen
Contributor III
Contributor III
Author

Here are the data that I obtain with the calculated dimensions (last  2 columns) :
RBC+-.pngThe result that I'm looking for is that the column RBC and the column with the calculated dimension =Aggr(sum(%RBC),OrderPost_id) show the same number. It works for every positive number, but not with negative ones. I don't understand how these amounts are calculated. I tried to change the dimension in the aggr function but it doesn't seem to work.