Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Tell us which business and trade publications you read most regularly: RESPOND NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
sayali_gajare
Contributor II
Contributor II

Previous year for selected year from filter

if(GetSelectedCount(InvYear)=1,

Sum({$<Year={'$(=max(InvYear)-1)'}>} [#GrossAmount]*ConvertRate),

Sum([#GrossAmount]*ConvertRate)

)

 

currently I have data for year 2018,19,20,21

when I select any year from filter I didnt get previous year data it shows data for selected year only

3 Replies
Taoufiq_Zarra

@sayali_gajare  Maye be :

if(GetSelectedCount(InvYear)=1,

Sum({$<Year={'$(=getfieldselections(InvYear)-1)'}>} [#GrossAmount]*ConvertRate),

Sum([#GrossAmount]*ConvertRate)

)
Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
sayali_gajare
Contributor II
Contributor II
Author

Thanks but not working

AshutoshBhumkar
Partner - Specialist
Partner - Specialist

Hi,

Can you please post an image of how your expression editor looks like and what is being calculated in set expressions?

Maybe, that will help us to understand more. The same kind of expression is working for me.

e.g 

If(GetSelectedCount (Year)=1,
Sum({<Year = {"$(=Max(Year)-1)"}>}Sales),
Sum(Sales)
)

Thanks,

Ashutosh