Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
jamelmessaoud
Creator II
Creator II

Help with expression

Hi guys,

This should be simple but I'm struggling to write the correct expression!

I have two measures.

  • Sum([Suppliers FTL Cost])
  • Sum({<[Sub Contractor Type] = {'Base Rate'}>}[Sub Contractor Rate])

I want to do a count of a field where the first measure is greater than the 2nd measure (and vice versa). 

Count Suppliers where Sum([Suppliers FTL Cost]) > Sum({<[Sub Contractor Type] = {'Base Rate'}>}[Sub Contractor Rate]) is basically what i want to achieve

Can anyone help?

Thanks

J

13 Replies
jamelmessaoud
Creator II
Creator II
Author

You are right Sunny it works like this.  Sorry I was using the wrong field - didn't want supplier.  Needed to use Sub Contractor

sum(Aggr(If(Sum([Suppliers FTL Cost]) > Sum({<[Sub Contractor Type] = {'Base Rate'}>}[Sub Contractor Rate]), 1, 0), [Sub Contractor]))

If i try the other way though

sum(Aggr(If(Sum({<[Sub Contractor Type] = {'Base Rate'}>}[Sub Contractor Rate]) > Sum([Suppliers FTL Cost]), 1, 0), [Sub Contractor]))

The result is always zero.  Do you think it will not work the other way?

Thanks

J

sunny_talwar
MVP
MVP

Difficult to say... may be you can share a sample to check?

jamelmessaoud
Creator II
Creator II
Author

It's ok Sunny.  Your expression is working just fine.  I need to think about how I want this to work

Thanks for your assistance

sunny_talwar
MVP
MVP

Awesome, I am glad it finally worked.

Best,

Sunny