Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
brijeshvma
Partner - Creator
Partner - Creator

if Condition with Set Analysis

Hi All

I Have a Simple Requirement , Where i Have a Product A and B ... My requirement is if sum of Product A is greater that B Than Count no of Branch,

Tab1:

Load * inline [

Branch,Product,sale,Sale1

a,A,100,200

b,A,200,120

c,B,300,230

d,A,400,401

d,B,401,500

e,A,500,497

f,A,501,203

];

i am Using a Expression as in text object

=Count(if(sum({<Product={'A'}>}sale)>=sum({<Product={'A'}>}sale1),Branch))

But i am getting an error that nested Aggregation not Allowed..

Output should be 5.

As well i am attaching an qvw.

1 Solution

Accepted Solutions
sunny_talwar

In fact shouldn't it be just 3? Try this

=Count({<Branch = {"=Sum({<Product={'A'}>}sale) >= Sum({<Product={'A'}>}Sale1)"}>} Branch)

Capture.PNG

View solution in original post

5 Replies
Clever_Anjos
Employee
Employee

Please try this:

=Count(aggr(if(sum({<Product={'A'}>}sale)>=sum({<Product={'A'}>}sale1),

Branch),Branch))

sunny_talwar

Is the output 5 or 4?

=Count(Aggr(If(sum({<Product={'A'}>}sale)>=sum({<Product={'A'}>}Sale1), Branch), Branch)


Shouldn't it be just a, b, e, and f?

Anonymous
Not applicable

Change the order of your Expression

=if (sum({<Product={'A'}>}sale)>=sum({<Product={'A'}>}sale1), count(Branch))

sunny_talwar

In fact shouldn't it be just 3? Try this

=Count({<Branch = {"=Sum({<Product={'A'}>}sale) >= Sum({<Product={'A'}>}Sale1)"}>} Branch)

Capture.PNG

Clever_Anjos
Employee
Employee

=Sum(Aggr(if(sum({<Product={'A'}>}sale)>=sum({<Product={'A'}>}sale1),1,0),Branch))

Please don´t consider my last answer