Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Qlikview Aggr() Net Price Calculation

Hi Team

I need to calculate Net Price, I have Net Sales And Net Volume fields available.

So I can calculate Net Price= [Net Sales]/[Net Volume]

Now I have to find the max net price value based on Region and Destination. For that I have written below expression. Which is working:

=Max(Aggr(Sum([Net Sales]/[Net Volume]),Region,Destination))


But now I have a requirement where I have to include only below combination of Net sales and Net Volume in my expression:

Net Sales ,Net Volume

+(values),+(values)

-(values),-(values)


Please suggest how can i modify my expressions for above combinations.


Thanks In Advance.

15 Replies
vishsaggi
Champion III
Champion III

Can you elaborate what you mean by +Values and -Values, Can you share some sample data with your expected output. ?

sunny_talwar

May be this

=Max(Aggr(Sum(If(Sign([Net Sales]) = Sign([Net Volume]), [Net Sales]/[Net Volume])), Region, Destination))

Anonymous
Not applicable
Author

Hi PFA image.

Test1.png

vishsaggi
Champion III
Champion III

Can we write this way too?

= Max(Aggr(Sum(If( [Net Sales] > 0 AND [Net Volume] > 0, [Net Sales]/[Net Volume])), Region, Destination))

sunny_talwar

But what about the negative condition? Meaning when both are negative?

vishsaggi
Champion III
Champion III

Oh Yeah. Thats correct going to be a long if condition.

sunny_talwar

Yes

Anonymous
Not applicable
Author

Yes... Please help

vishsaggi
Champion III
Champion III

Did you try what Sunny suggested? If not can you try and let us know where you having problems.