Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Now Live: Qlik Sense SaaS Simplified Authoring – Analytics Creation for Everyone: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
shumailh
Creator III
Creator III

Set Analysis Issue - Comparing two Fields

I am trying to compare two fields and unable to get the required value, below is my data:

AccNoMonthName_IDMonthNameMTD_IDMonthNameyTD_IDMonthNameYOY_IDBal
12456Jan-11Dec-10Jan-11Feb-10   154,100.00
15144May-11Apr-11Jan-11Jun-10     10,054.00
65112Jun-11May-11Jan-11Jul-10   320,496.00
41120Nov-10Sep-10Jan-10Dec-09     12,054.00
45661Apr-11Mar-11Jan-11May-10     21,560.00
57482Jun-11May-11Jan-11Jul-10       1,541.00
78441May-11Apr-11Jan-11May-10   540,000.00

Below is the expression i am using to get the bal

=(sum({$<MonthName_ID = ${MonthNameMTD_ID}>} bal)

Shumail

8 Replies
erichshiino
Partner - Master
Partner - Master

Try this:

=(sum({$<MonthName_ID ={"=$(MonthNameMTD_ID)"}>} bal)

Hope this helps,

Erich

shumailh
Creator III
Creator III
Author

not working i tried the same after correction but still no solution

=sum({$<MonthName_ID ={"=$(MonthNameMTD_ID)"}>} bal)

I review the below link which mentions that i could nt compare two fields in set analysis... [:S]

http://community.qlik.com/message/101556#101556

erichshiino
Partner - Master
Partner - Master

Hi,

I changed the syntax a little bit

Please, check attachment

Regards,

Erich

vikasgupta
Creator
Creator

Hi Erich

I wants to compare two fields using set expression. I used your expression but i am not getting required result its return 1000 instead of 700 so i wants to ask you that we can not use set expression for comparing two fields ?

but if we are using IF condition then its working correct.

plz finds the attached for same and if if any alternative is there then plz let me know .

Thanks

Vikas gupta

Not applicable

Thanks!!! I was searching for this solution!

maxgro
MVP
MVP

=sum( {$ <AccNo={"=MonthName_ID=MonthNameyTD_ID"}>} Bal )

Not applicable

I don't understand why "1000" is returned. We're comparing fields (Table1.Name and Table2.Name) from separate tables which have no join (i.e. joinless tables -- no line between them in the editor) Since there is no join, maybe the comparison is moot. (Qlikview just does the cartesian product when you mix joinless tables) And since you're summing Table2.Amt, it just checks whether Table2 is filtered at all and accepts that filter...

rcurlewis
Partner - Contributor II
Partner - Contributor II

Hi Shumail,

My suggestion is to look at the P/E options in SET ANALYSIS.  It works when you want to say P = Possible Values a E = Exclude Values.

I use it as follows as an example: Sum({<[Type]= {'Value'}, [Field1]= P(Field2)>} [Amount]).  Note the Round Brackets with P/E as these are functions.

Your expression: =(sum({$<MonthName_ID = P(MonthNameMTD_ID)>} bal)

Hope this helps

*Sorry just a note.  This is taking every Possible Value and not just the value - so test it as this resolved quite a number of my issues in the past*

According to Rob Wunderlich you can also do this: sum({<RecId={"=F1=F2"}>}Amount)