Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Support Cases coming to Qlik Community Oct. 4! Start chats, open cases, explore resources: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikviewse
Contributor
Contributor

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) 

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)

tresesco
MVP
MVP

=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)))

qlikviewse
Contributor
Contributor
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))

qlikviewse
Contributor
Contributor
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

qlikviewse
Contributor
Contributor
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))