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

Announcements
We are aware of an issue with the Product Downloads page and looking into it.
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
MVP
MVP

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