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

Doubt regarding a formula withSET ANALYSIS OR AGGR

Hi

I don't know if my problem have to be solved with what option: i have to count the number of invoices that in the total have 3 units or less units invoiced.

I had tried with these 2 options but for some reason they don't work. On the other hand I don't know which is the best option of them to solve this problem, could you explain why???

the formulas that I wrote are these:

formula 1: Count(AGGR(SUM([UN VENDIDAS])<=3, NUM.FACTURA)) - this formula is not working well because its counting the invoices that have lines with 3 or less units instead of just counting the invoices that have 3 or less units in the total.

formula 2: Count({< Sum ([UN VENDIDAS])<=3 >} DISTINCT NUM.FACTURA) - this formula is showing error in the syntaxis

Thanks for your help

Regards,

PMJT

18 Replies
Not applicable
Author

Hi once again

im trying with this formula to discard 0 records but its not working:

Count({< [NUM.FACTURA] = {'=Sum([UN VENDIDAS])= {1,2,3}'} >} DISTINCT  [NUM.FACTURA])

what should i change???

thanks for your comments

regards,

Anil_Babu_Samineni

That won't work because How Sum([UN VENDIDAS]) has the values are 1,2,3

You mean to say this?

Count({< [NUM.FACTURA] = {'=Sum([UN VENDIDAS])= {1 or 2 or 3}'} >} DISTINCT  [NUM.FACTURA])

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Not applicable
Author

Hi Anil

Sorry for not answering before,.,.,I had tried your solution however it dont work. On the other hand i have a question: if  i would want consider a bigger range I had saw many options with this kind of script

Count({< [NUM.FACTURA] = {'=Sum([UN VENDIDAS])= {">0","<=3"}'} >} DISTINCT  [NUM.FACTURA])

do you know why its not working?

thanks for your help

regards,

PMJT

sunny_talwar

You can do this:

Count({<[NUM.FACTURA] = {"=Sum([UN VENDIDAS]) > 0 and Sum([UN VENDIDAS]) <= 3"} >} DISTINCT  [NUM.FACTURA])

Anil_Babu_Samineni

Ranges should be syntax as follow

Count({< [NUM.FACTURA] = {'=Sum([UN VENDIDAS])= {">0 <=3"}'} >} DISTINCT  [NUM.FACTURA])

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Not applicable
Author

Thanks a lot Sunny, your solution worked perfectly. now i see that a "problem" in Qlikview could have many approaches however im still dont understand why one solution could work with some context and in other context dont.

Regards,

PMJT

Not applicable
Author

Hi Anil

I tried with your changes however it didn't work. Do you have any idea why?

regards,

PMJT

sunny_talwar

I think a good place to start for set analysis would be this

A Primer on Set Analysis

and also read this:

Set Analysis: syntaxes, examples

sunny_talwar

Syntax isn't right pedro... I am not sure what the idea was behind Anil's expression, but it isn't the right way to code it