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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
AlokVerma
Contributor
Contributor

Error is Set Expression

Can someone help me fix this? Error in expression.

 

sum
(
{$

< YearNum = {'$(=Max(YearNum-1))'} >

}

Cost
)

Labels (1)
1 Solution

Accepted Solutions
Kushal_Chawda

@AlokVerma Cost field name is not available in your data model. See the colour of YearNum column . It jas to be same colour. Check the correct field name for cost

View solution in original post

9 Replies
BrunPierre
Partner - Master II
Partner - Master II

=Sum({$<YearNum = {'$(=Max(YearNum)-1)'}>} Cost)

Chanty4u
MVP
MVP

 

Try this 

sum({< YearNum = {"$(=Max(YearNum)-1)"}>}Cost)

 

AlokVerma
Contributor
Contributor
Author

@BrunPierre Not working even after adding = & taking 1 away from Max bracket as suggested.

AlokVerma
Contributor
Contributor
Author

Still showing "Error in expression". I tired by removing the $ already. It's little weird that this simple SET EXPRESSION is throwing error and i'm having no clue of what is going wrong.

Chanty4u
MVP
MVP

Try this 

Sum(Aggr(If(YearNum = Max(YearNum)-1, Cost), YearNum))

 

Kushal_Chawda

@AlokVerma  use double quotes and make sure that Field Name used in set is valid.

=Sum({$<YearNum = {"$(=Max(YearNum)-1)"}>} Cost)

AlokVerma
Contributor
Contributor
Author

@Kushal_Chawda Please see below from the expression window. I'm using desktop version 14.54.2(Feb 2022)

 

Capture.PNG

 

Kushal_Chawda

@AlokVerma Cost field name is not available in your data model. See the colour of YearNum column . It jas to be same colour. Check the correct field name for cost

AlokVerma
Contributor
Contributor
Author

@Kushal_Chawda Thanks ! Figured out.

I have 2 Cost measure in my data set & was referring to incorrect Cost somehow( Cost was showing light purple color when expression was throwing error). It should have been ([Patient Details.Cost]).

Capture.PNG