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: 
Not applicable

Set analysis and adding an absolute value to only one year

Hello,

I have an object which goes as follows:

=Sum ( {<[Financial Year]={$(vYears)}>} [Amount])

The variable 'vYears' has two values: 2012 en 2013.

The result is the sum(Amount) for 2012 and 2013.

Now I want to add 1000 only to the year 2012.

I con't figure out how. Any Help?

Thanks!

Message was edited by: Jasper de Vries

1 Solution

Accepted Solutions
CELAMBARASAN
Partner - Champion
Partner - Champion

Try this

= Sum ({$<[Financial Year] = {$(vYears)}>} Amount ) + If([Financial Year] = 2012, 1000, 0)

View solution in original post

12 Replies
swuehl
MVP
MVP

If you are using the expression in a textbox,

=Sum ( {<[Financial Year]={$(vYears)}>} [Amount])+1000


should return the correct result, right?

But you are probably using the expression in a chart with multiple dimensions.

But how should the constant value for the year then distributed across your dimension values?

Not applicable
Author

Hi swuehl,

Unfortunately that's not what I mean. If I follow your advise, 1000 wil be added to both years while I want to add 1000 only to one year, while 2 years are shown.

sunilkumarqv
Specialist II
Specialist II


try like these

=Sum ( {<[Financial Year]={$(=(vYears)-1)}>} [Amount])+1000

or


=Sum ( {<[Financial Year]={$(=Max(vYears)-1)}>} [Amount])+1000


or

create varible for 1 year which year you want then make that variable use





PrashantSangle

Hi ,

try this,

=if($(vYears)='2012',Sum ( {<[Financial Year]={$(vYears)}>} [Amount])+1000,Sum ( {<[Financial Year]={$(vYears)}>} [Amount]))


Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Not applicable
Author

Thanks guys, but I doesn't solve my problem.

I attached an example QVW to my orginal post. Hope this will clarify my issue.

Not applicable
Author

Can you please try below:

= sum ({$<[Financial Year] = {$(vYears)}>} Amount)+sum({$<[Financial Year] = {"2012"}>}1000)

CELAMBARASAN
Partner - Champion
Partner - Champion

Try this

= Sum ({$<[Financial Year] = {$(vYears)}>} Amount ) + If([Financial Year] = 2012, 1000, 0)

veidlburkhard
Creator III
Creator III

Hi Jasper,

the solution is a simple if condition on Fincancial Year:

=If([Financial Year] = 2012, sum({$<[Financial Year] = {$(vYears)}>} Amount ) +1000, sum({$<[Financial Year] = {$(vYears)}>} Amount))

Enjoy

Burkhard

qlikpahadi07
Specialist
Specialist

Hi Jasper,

you can use "IF"code if([Financial Year] = '2012', sum ( {$} Amount ) +1000 , if([Financial Year] = '2013', sum ( {$} Amount ) ))

PFA for help.