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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
TomBond77
Specialist
Specialist

Error in set modifier expression

Hi experts

What's wrong with this formula?

I am getting the error "Error in set modifier expression":

Sum({<([A]-[B])={">-6<1"}, [Year]={$(=max([Year]))}>}
FABS([A]-[B]))

Many thanks

Tom

1 Reply
marcus_sommer

A condition within the set analysis must be done always against fields and not against a calculation. In your case you could change it in this way:

Sum({<[AnyRelevantID]={"=match([A]-[B], -5,-4,-3,-2,-1,0)>0"}, [Year]={$(=max([Year]))}>}
FABS([A]-[B]))

which is quite the same like:

if([A]-[B] >-6 and [A]-[B] <1, Sum({< [Year]={$(=max([Year]))}>} FABS([A]-[B])))

If you want to use a real set analysis you need to do this within the script:

[A]-[B] as [A-B]

and then:

Sum({<[A-B]={">-6<1"}, [Year]={$(=max([Year]))}>} FABS([A-B]))

- Marcus