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

Announcements
Talend Cloud AWS EU Scheduled Outage: Starting Tues 26 May 21:00 CEST with expected completion Wed 27 May 01:00 CEST
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Two prices, choose higher


Hi everybody.

I have a problem with set analysis calculation. There is some articles that more than one purchase price and I need to do calculation higher price, but everything that attemp fails.

This is the correct expression for articles with a single price purchase:

SUM({<AÑO_HASTA={9999},CARGO_ABONO={0}>}(PRECIO_COMPRA-(PRECIO_COMPRA*DTO/100))*CANTIDAD / IF(CONVERSION=0,1,CONVERSION)

And this is to find the maximum price

SUM({<AÑO_HASTA={9999},CARGO_ABONO={0}>} AGGR(MAX(PRECIO_COMPRA),CODIGO_ARTICULO)-                                                                                     (AGGR(MAX(PRECIO_COMPRA),CODIGO_ARTICULO)*DTO/100) / IF(CONVERSION=0,1,CONVERSION)

Somebody can help me?

Labels (1)
13 Replies
swuehl
Champion III
Champion III

I have attached my version. I noticed that the results are not the same compared to the 3. column, depending on selections.

Regards,

Stefan

Not applicable
Author

Hi Stefan,

Forgive the late response, the results are incorrect, I encounter a problem in the expression, I think the set_analysis not work, if you look you will see that the table is selected ultima_tarifa 9999 and if you cancel that selection results vary set_analysis and should not because it is a condition for the set for the sum ..... I don´t think use sum(cantidad) is correct in set analysis.

I think I'll go crazy.

Thanks for your help

swuehl
Champion III
Champion III

Hi Gabriel,

yes, that's looks a bit confusing now, I am also struggling. Though I still think that using sum(cantidad) in the aggr() functions should be ok, the results seems to look ok to me also on a per row base.

Regarding the set expression, I think you should consider putting the set expression in the sum as well as in the aggregation functions in the aggr() functions (max() and sum() there). Having this, your numbers will not change on selecting / deselecting ano_hasta 9999.

Since there are a lot more fields to select from (e.g. Mes and Dias), you might take care of the possible alternative selections the user can make, i.e. by clearing the selection state of those fields.

You might want to take a look here:

http://iqlik.wordpress.com/2010/11/27/the-magic-of-set-analysis-point-in-time-reporting/

Hope this helps,

Stefan

Not applicable
Author

Hi

Thanks for your help Stefan, I'll keep trying

Regards