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

Expression Formula Error

I am trying to use this formula in a expression, while i try and do that I get a error. The main purpose of the formula is to "flag the field if it is >.75 with a 1, and if it is less than .75 by a 0. Please let me know if there is a easier way to do this

=if(sum({<Reporting_Period_Num ={"$(=max(Reporting_Period_Num))"}, {$<[CDU LOS] = {'*'}>} CDU_Percent)

and

sum({<Reporting_Period_Num ={"$(=max(Reporting_Period_Num)-1)"}, {$<[CDU LOS] = {'*'}>} CDU_Percent)>= .75 ,'1','0')

Please help Scholars

Note: Edited by moderator for title brevity.

Labels (1)
1 Solution

Accepted Solutions
Peter_Cammaert
Partner - Champion III
Partner - Champion III

If you are trying to flag the sum(Percentage) for current period + sum(Percentage) for previous period as being larger than 75%, replace the and between the two sums by a +. There are a few superfluous braces and other characters as well (you don't have to specify sets inside sets). To fix this, remove the {$< characters in both sum() calls (that's probably the reason why you're getting an expression error).

If my first assumption is correct, your expression now looks like:

=if(sum({<Reporting_Period_Num ={"$(=max(Reporting_Period_Num))"}, [CDU LOS] = {'*'}>} CDU_Percent)

+

sum({<Reporting_Period_Num ={"$(=max(Reporting_Period_Num)-1)"}, [CDU LOS] = {'*'}>} CDU_Percent)>= .75 ,1,0)

Note: when getting expression errors, always start by checking the proper balancing of parentheses, braces, squarze brackets and the lot. Might save you a lot of time and effort! The syntax checker will even help you with finding missing markers. Place your cursor immediately before a brace or parenthesis. It will be underlined by a colored stripe (usually orange). The corresponding brace or parenthesis will be underlined as well. If not, the syntax checker will make a guess as to where it should be, and mark the remainder of the expression as faulty using "red wiggly lines".

Best,

Peter

View solution in original post

2 Replies
Peter_Cammaert
Partner - Champion III
Partner - Champion III

If you are trying to flag the sum(Percentage) for current period + sum(Percentage) for previous period as being larger than 75%, replace the and between the two sums by a +. There are a few superfluous braces and other characters as well (you don't have to specify sets inside sets). To fix this, remove the {$< characters in both sum() calls (that's probably the reason why you're getting an expression error).

If my first assumption is correct, your expression now looks like:

=if(sum({<Reporting_Period_Num ={"$(=max(Reporting_Period_Num))"}, [CDU LOS] = {'*'}>} CDU_Percent)

+

sum({<Reporting_Period_Num ={"$(=max(Reporting_Period_Num)-1)"}, [CDU LOS] = {'*'}>} CDU_Percent)>= .75 ,1,0)

Note: when getting expression errors, always start by checking the proper balancing of parentheses, braces, squarze brackets and the lot. Might save you a lot of time and effort! The syntax checker will even help you with finding missing markers. Place your cursor immediately before a brace or parenthesis. It will be underlined by a colored stripe (usually orange). The corresponding brace or parenthesis will be underlined as well. If not, the syntax checker will make a guess as to where it should be, and mark the remainder of the expression as faulty using "red wiggly lines".

Best,

Peter

Anonymous
Not applicable
Author

thank you.