Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Incorrect expression

I am looking to make a sum of PrixVente when [Structure] ={'1174*'} and for the last year ,

the following expression returns wrong values , how to correct it ?

=if(IsNull(GetFieldSelections(Week,'*')),Sum({$<Year={$(=max(Year-1))}>}{<[Structure] ={'1174*'}>}PrixVente)

,Sum({$<Weekyear= {$(=max(Weekyear-1))}>}{<[Structure] ={'1174*'}>}PrixVente))

1 Solution

Accepted Solutions
sushil353
Master II
Master II

Try :

=if(IsNull(GetFieldSelections(Week)),Sum({$<Year={'$(=max(Year)-1)'} ,[Structure] ={"1174*"}>}PrixVente)

,Sum({$<Weekyear= {'$(=max(Weekyear)-1)'},[Structure] ={"1174*"}>}PrixVente))

HTH

View solution in original post

5 Replies
sushil353
Master II
Master II

Try :

=if(IsNull(GetFieldSelections(Week)),Sum({$<Year={'$(=max(Year)-1)'} ,[Structure] ={"1174*"}>}PrixVente)

,Sum({$<Weekyear= {'$(=max(Weekyear)-1)'},[Structure] ={"1174*"}>}PrixVente))

HTH

qlikmsg4u
Specialist
Specialist

try this

=if(IsNull(GetFieldSelections(Week)),Sum({$<Year={$(=(max(Year)-1))}>}{<[Structure] ={'1174*'}>}PrixVente)

,Sum({$<Weekyear= {$(=(max(Weekyear)-1))}>}{<[Structure] ={'1174*'}>}PrixVente))

maxgro
MVP
MVP

I think

=Sum( {$ <Year={$(=max(Year)-1)},Structure ={"1174*"}>} PrixVente)

same for WeekYear

jonathandienst
Partner - Champion III
Partner - Champion III

The above posts correct the syntax error in your expression.

What is the format of Weekyear? Is it text or numeric? The QV Weekyear function returns a year value.

If weekyear means the week number in the year, then max(Weekyear) will not work correctly over the year end (week1 - 1 = week52 of prior year). You need to do proper date calculation - do you have a date field?

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anonymous
Not applicable
Author

HI,

Try this:

=if(IsNull(GetFieldSelections(Week,'*')),Sum({<Year={'$(=max(Year)-1)'},[Structure] ={'1174*'}>}PrixVente)

,Sum({<Weekyear= {'$(=max(Weekyear)-1)'},[Structure] ={'1174*'}>}PrixVente))