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: 
Anonymous
Not applicable

Need Help for an Intersection Problem in Set Analysis

Hi at all,

i have a problem with an intersection in Set Analysis.

I have one Table with Parts, Prices and Factorys.

I need the difference beetween the Prices in two different Factories for the Same Part.

How is the correct Expression with Aggr in a Text Field?

Details in the Example (.qvw) 

Labels (1)
10 Replies
MK_QSL
MVP
MVP

=IF(sum({<Factory= {'200'}>} Price) > sum({<Factory= {'100'}>} Price), sum({<Factory= {'200'}>} Price)- sum({<Factory= {'100'}>} Price))

or

=Aggr(IF(sum({<Factory= {'200'}>} Price) > sum({<Factory= {'100'}>} Price), sum({<Factory= {'200'}>} Price)- sum({<Factory= {'100'}>} Price)),Part, Factory)

tresB
Champion III
Champion III

=If( (sum({<Factory= {'200'}>} Price) -sum({<Factory= {'100'}>} Price))>0,sum({<Factory= {'200'}>} Price) -sum({<Factory= {'100'}>} Price))

PFA

mdmukramali
Specialist III
Specialist III

Dear ,

can you try like

=if(sum({<Factory= {'200'}>} Price)>sum({<Factory= {'100'}>} Price),(sum({<Factory= {'200'}>} Price))-(sum({<Factory= {'100'}>} Price)))

Anonymous
Not applicable
Author

yes thank you. but i need an aggr expression in a textbox for the result

only if PART exist in Factory 100 and PART exist in Factory 200 then make the Price Difference #

the result is the SUM: in this exampe 10+4 = 14

MK_QSL
MVP
MVP

=SUM(Aggr(IF(sum({<Factory= {'200'}>} Price) > sum({<Factory= {'100'}>} Price), sum({<Factory= {'200'}>} Price)- sum({<Factory= {'100'}>} Price)),Part, Factory))

Anonymous
Not applicable
Author

thank you, but the result of your expression is "175" ... the correct result is 14 (screenshot)aggr.PNG.png

MK_QSL
MVP
MVP

Can you elaborate little more what are expecting ?

Thanks

Anonymous
Not applicable
Author

I need the price difference beetween the parts who exist in Factory 100 and Factory 200.

Example:

the part 666 and 777 exist in both Factorys but in factory 200 is the part 666 and 777 more expensive.

i need an expression for following conditions:

- Parts are the SAME - Part exist in both factorys

- If in Factory 200 the price is higher than in Factory 100 then i need the sum

for this example is 14 (see screenshot above)

MK_QSL
MVP
MVP

Use this...

=IF(SUM({<Factory = {'200'}, Part = P({1<Factory = {'100'}>})>}Price) > SUM({<Factory = {'100'}, Part = P({1<Factory = {'200'}>})>}Price),

SUM({<Factory = {'200'}, Part = P({1<Factory = {'100'}>})>}Price) - SUM({<Factory = {'100'}, Part = P({1<Factory = {'200'}>})>}Price))