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

If Formula

Hi All

I am having an issue with an IF formula and need some help.

I have data in excel which looks like this:

IDFinYrFinMthFinAmt
1000008-G201322059
1000018-G20131200
1000018-G20133-499
1000018-G20137-2503
1000020-G20132-2389
1000022-G20131-1070.31
1000024-G20133-1741
1000026-G2013120000
1000026-G20133-2001
1000026-G20138600
1000026-G201310461.25
1000026-G20131211400
1000026-G2014226600
1000026-G201470
1000026-G2014108041.2
1000027-G20133-101
1000027-G20134288

I want my formula to say something like this.

if(Finyr = "2013", Sum(aggr(sum(FinAmt), 0 ))))

I will then plot it on a graph by the Fin month so i am getting the Aggr amount month on month.

My graph will look like this:

Graph.png

Can anyone help me with this formula??

Thanks

Andrew

1 Solution

Accepted Solutions
marcus_malinow
Partner - Specialist III
Partner - Specialist III


Just use

Sum({$<FinYear={'2013'}>} FinAmt)

and in the expression settings use Full Accumulation

View solution in original post

9 Replies
Anonymous
Not applicable
Author

Hi

use this

=Sum(Aggr(If(FinYr = '2013',FinAmt)))

Not applicable
Author

Hi, Thanks for you help

However it does not seem to work. It is still saying "Error in expression"

Any more thoughts??

PrashantSangle

Hi,

When you use AGGR() it will take min two parameters,

Just check your logic in your logic You are aggregating with 0 why?

Why you need aggr()?

Try like

if(Finyr = "2013",sum(FinAmt), 0 )

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 🙂
Anonymous
Not applicable
Author

Hi

Use this

Sum(Aggr(If(FinYr='2013',FinAmt),FinAmt))

Anonymous
Not applicable
Author

Hi

Use like

=Sum(aggr(if(FinYear = '2013',FinAmt)

marcus_malinow
Partner - Specialist III
Partner - Specialist III


Just use

Sum({$<FinYear={'2013'}>} FinAmt)

and in the expression settings use Full Accumulation

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Do you mean a cumulative amount (that's what the graph looks like). You can do that by using  Sum(FinAmt) for the expression and checking one of the accumulate buttons on the expression dialog. Or you can use a RangeSum(Above()) construction to manually accumulate.

Do you want to filter to a particular year? Add a Year listbox so the user can select year and use Sum(FinAmt) as your expression. No need for an aggr() expression which will do nothing except possible harm performance if your data set is large. You can apply a conditional display or conditional calculation if you want to only display the chart if a year is selected.

HTH

Jonathan

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

That's the one. I knew something was going wrong, I had the above formulas and also the expression setting set to full accumulation.

Thanks all for your help.

giacomom
Partner - Contributor III
Partner - Contributor III

Hi Andrew,

if you want to aggregate by months you can use the formula:

=Aggr(sum(If(FinYr='2013',FinAmt, 0)), FinMth)

Regards,

Giacomo